8

lst = {"x1x2", "x1", "x1x2x3", "x3", "x4", "x1x2x3x4"}; You can use a combination of StringRiffle and StringPartition StringRiffle[StringPartition[#, 2], "&&"] & /@ lst {"x1&&x2", "x1", "x1&&x2&&x3", "x3", "x4", "x1&&x2&&x3&&x4"} Alternatively, you can use StringReplace: StringReplace[lst, ...


8

This is what you want ? StringJoin[Riffle[Partition[Characters[#], 2], "&&"]] & /@ {"x1x2", "x1", "x1x2x3", "x3", "x4", "x1x2x3x4"} (* Out: {"x1&&x2", "x1", "x1&&x2&&x3", "x3", "x4", "x1&&x2&&x3&&x4"} *)


7

(Extended comment, not an answer. From the comments to it by OP I do no see the point expanding it further into full blown answer. Thanks to everyone who reacted to it...) Procedure outline Ingest text data. I used Air BnB review data from this site : http://insideairbnb.com/get-the-data.html . Approx. 16000 reviews. (Out of ~500K from Austin, TX and Fort ...


6

Create the right structure and then use TeXForm: CenterDot @@ Replace[ FactorInteger[4708352000], {b_, p_Integer} :> HoldForm[b]^p, {1} ] // TeXForm 2^{14}\cdot 5^3\cdot 11^2\cdot 19


4

You can use TeXForm to do most of the work for you. You only need to replace your custom operators with the built-in ones, so that TeXForm knows which symbols to use: makeTeX[expr_] := HoldForm[expr] /. {and -> And, or -> Or, not -> Not, Equal -> Congruent} // TeXForm makeTeX[and[or[c, a], not[and[a, b]]] == or[and[not[a], c], and[not[b], ...


4

One possibility is to use ReplaceAll (the short form of which is /.) with a list of rules. There are probably more concise ways of doing this that I'm not seeing. {{0, 0, 0}, {0, 0, 1}, {0, 1, 0}, {0, 1, 1}, {1, 0, 0}, {1, 0, 1}, {1, 1, 0}, {1, 1, 1}} /. {{0, 0, 0} -> 1, {0, 0, 1} -> C, {0, 1, 0} -> B, {0, 1, 1} -> BC, {1, 0, 0} -> A, {1, ...


4

lists.{"A", "B", "C"} /. 0 -> "1" /. Plus -> StringJoin {"1", "C", "B", "BC", "A", "AC", "AB", "ABC"} % // ToExpression {1, C, B, BC, A, AC, AB, ABC}


3

The expression "true" represents the string with content true, not "true". To get the string including the quotes, you need to add them to the string, which means it should be "\"true\"" (the \ is to escape the ", so that it is not confused with the end of the string). And you want to replace it with the string containing true, that is "true". Put together, ...


3

Here's a way to do it (it's bad practice to put an involved answer in a comment so I'm moving it here): lists = {{0, 0, 0}, {0, 0, 1}, {0, 1, 0}, {0, 1, 1}, {1, 0, 0}, {1, 0, 1}, {1, 1, 0}, {1, 1, 1}}; With[{a = ToUpperCase@Alphabet[]}, StringJoin /@ MapIndexed[If[# == 1, a[[#2[[-1]]]], ""] &, lists, {2}] /. "" -> "1" ] (* Out: {"1", "C", "...


2

Map[ ToExpression@*StringJoin, Transpose[ MapThread[ ReplaceAll, {Transpose[a], {{1 -> "A"}, {1 -> "B"}, {1 -> "C"}}} ] ] /. 0 -> Nothing /. {} -> "1" ] {1, C, B, BC, A, AC, AB, ABC}


2

("146d0" A + "-594d0" B) /. s_String?(StringStartsQ["-"]) :> -StringDrop[s, 1] (* "146d0" A - "594d0" B *)


2

{"sample", "voltage", "length"} /. StringCases[ d, Flatten @ { "sam" ~~ sn : NumberString :> ("sample" -> ToExpression[sn]), m : (NumberString ~~ LetterCharacter ... ~~ #2) :> (# -> QuantityMagnitude[m, #3]) & @@@ { {"voltage", "V", "mV"}, {"length", "m", "nm"}}(*name - base unit - final unit*) } ] {{1, 80.0, 500}, {...


2

If I understand you: cfform[{b_, d___}] := Row[{"[", b, ";", ##, "]"}] & @@ Riffle[{d}, ","] TableForm[{table1, cfform /@ table2}\[Transpose], TableHeadings -> {None, {"R", "CF of R"}}]


1

A list of even-length strings: list = {"12", "1234", "123456", "12345678"}; You can use StringInsert: StringInsert[#, " ", 1 + StringLength[#]/2] & /@ list {"1 2", "12 34", "123 456", "1234 5678"} Alternatively, you can use a combination of StringPartition and StringRiffle: StringRiffle[StringPartition[#, StringLength[#]/2]] & /@ list {"1 ...


1

You could use Interpreter to extract the quantities with the units preserved. Interpreter["Quantity"] /@ Take[#, -2] & @ StringSplit[#, "_"] & /@ d InputForm @ % (* {{Quantity[80., "Millivolts"], Quantity[500, "Nanometers"]}, {Quantity[450, "Nanometers"], Quantity[300., "Millivolts"]}, {Quantity[1.1, "Volts"], Quantity[6, "Micrometers"]}} *)


1

"" <> Pick[{"A","B","C"}, #, 1] & /@ lists /. "" -> 1 {1, "C", "B", "BC", "A", "AC", "AB", "ABC"}


Only top voted, non community-wiki answers of a minimum length are eligible