A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

Questions tagged [string-manipulation]

Questions on the manipulation of String objects in Mathematica, and the functions used for these manipulations.

Filter by
Sorted by
Tagged with
2
votes
3answers
61 views

How to get string from the result of BaseForm function

I want to get the string "b0.3ae" In:=BaseForm[176.23, 16] Out:=Subscript[b0.3ae, 16] And then I want to get 176.23 by ...
8
votes
2answers
293 views

StringReplace with multiple patterns

I am experiencing what seems to be a strange behaviour with StringReplace while trying to add an extra pattern to an existing list of patterns. The problem is to translate a string into Morse code, ...
1
vote
1answer
34 views

Split a string by characters or position from the right and return two components

If I have a string MyString = "MyString" what is the best way to split it by characters or positions from the right. My current solution is to break the string ...
1
vote
0answers
58 views

Importing a table of real numbers from a text file were data is represeted in Fortran form [closed]

I'm working on a project that is analyzing seismic displacement data in the above form. It's basically a text file but I could conceivably need to bring in hundreds of files each containing anywhere ...
0
votes
0answers
45 views

Is there a way to replace string with padding?

...
3
votes
1answer
65 views

How do I get parantheses into an exponent inside a string

I would like to write $R^{(2)}$ and use this as a FrameLabel. This means that I specifically want () around the 2 in the exponent. I've tried using ...
0
votes
0answers
53 views

How to apply command to all elements of a list?

So I generated a list of cities and I want to apply FindGeoLocation to all of them without having to seperate the elements and then applying. ...
0
votes
0answers
32 views

DatePattern “MonthName” with foreign languages?

Is there a way to get DatePattern to work with date "MonthName"s in foreign languages? ...
0
votes
0answers
32 views

Highlight matches in string by color [duplicate]

Suppose I have "Some potentially multiline string". Is there a way I can have all instances of some matching word, say ...
2
votes
1answer
48 views

How to create a multicolored string? [duplicate]

I'm interested in displaying a string composed from sub-strings of different colors. Mathematica allows one to create a list comprising sub-strings of different colors, for example ...
0
votes
1answer
32 views

Misbehaving `Table`

(To be fair, it's not Mathematica that is 'misbehaving'; this is actually down to my limited coding skills.) I have the following Table: ...
0
votes
1answer
28 views

Splitting A String into two parts [closed]

I have a string of four numbers 1123 that happens to be a set of a larger string, but I want to work on splitting that part first. In theory, I want to split 1123 into two parts separated by a space: ...
1
vote
1answer
42 views

Removing quotes that appear in a string

I'm trying to remove "" from the pattern "true" in the string ...
3
votes
2answers
45 views

Extract values from strings according to units

I have a lot of strings, which have simple nomenclature of number-unit associations and am looking to extract the number according to the units. For example: ...
5
votes
2answers
234 views

How to insert a character between any several characters without knowing indexes?

There is a list of strings: {"x1x2", "x1", "x1x2x3", "x3", "x4", "x1x2x3x4"} The goal is to insert "&&" between every two elements in a list. I need to ...
6
votes
6answers
355 views

How to replace numbers by letters in a special way?

There are few sublists: 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}} The goal is to put A if the first element of a sublist ...
-1
votes
2answers
107 views

How to take the negative sign in a string

What pattern should i give to the following expression ("146d0" A + "-594d0" B) so i would get ("146d0" A - "594d0" B)
2
votes
1answer
31 views

Convert output from FactorInteger to LaTeX

Is it possible to transform the output from FactorInteger to form a LaTeX-output as follows; e.g. FactorInteger[4708352000] ...
1
vote
1answer
68 views

Convert ProofNotes to $ \mathrm\LaTeX $ logic expression

The following code will generate some ProofNotes: ...
0
votes
1answer
31 views

How to import the following file as a dataset?

Consider a file 'temp.txt' (alternative link). I am trying to import it as a data-file, i.e. in the form XXX XXX XXX XXX where XXX denotes numbers. However, I am ...
0
votes
1answer
24 views

How to remove the rows in the following file?

Consider a file file.txt having the form ...
3
votes
1answer
55 views

How to make a histogram showing the frequency of word length?

I have to analyze the novel Don Quixote, so I am trying to make a histogram where each bin is how many characters in a word, and the height being the frequency of words with that many characters.
8
votes
3answers
258 views

Faster way to solve android lock valid patterns

With the password grid shown in the Android home screen, how many valid passwords are possible? The rules for creating a pattern is as follows. We must use four nodes or more to make a pattern at ...
2
votes
1answer
34 views

Removing all sublists containing any arbitrary string as one or more of its list component

so, basically I have a list of sublists of varying length. For example, ...
2
votes
1answer
53 views

Convert any number into a friendly file name

I often need to export many similar plots with just one parameter changed. I like to include the parameter in the file name. For example ...
2
votes
2answers
47 views

Convert string of tuple of numbers to complex number

I am reading complex number from a file which gives me a list like that ...
5
votes
1answer
149 views

Decode Image from Base64

From a web API, I have a bunch of realllyyy long strings that look like this: data:image/jpeg;base64,(...) Sites like this will decode these strings no problem, ...
0
votes
1answer
33 views

importing a list of lists

I have a list of lists, a list of file paths for some number of directories. I want to import that files as lists of lists, where instead of getting one massive 1D list, the distinct directories are ...
2
votes
4answers
103 views

Appending to each string in a list with mapping

I have a list of 100 things: endings = ".w_" <> ToString[#] <> "_cold.r_0" <> ".xvg" & /@ Table[i, {i, 0, 99, 1}] And I'm trying to add 20 ...
4
votes
2answers
87 views

Manipulation and sorting of date strings, location Australia

Question 1 DateObject["30.08.90"] returns Day: Mon 2 Jun 1997. How do I get ...
0
votes
3answers
88 views

Using StringJoin

Is there a way to use StringJoin to go from: {{abc, 0000}, {def, 1111}} To {{abc_0000},{def_1111}} I've been trying to use Map and MapThread with StringJoin but have failed.
0
votes
2answers
46 views

Specify column data type when importing

I'm running into an annoying issue when importing a table of tab-separated-data. Several columns are numeric, while several are strings. Using Import[url,"TSV"] ...
7
votes
2answers
125 views

splitting a string list

I have a list of consisting of strings and string representation of numbers: lis = {{"a (b) 1","c 2"},{"d 3","e f 4"}} and need to split the elements so that the ...
0
votes
1answer
47 views

How can I associate letters with numbers in a text, keeping their positions?

I would like to ask you how I can associate a letter with a number in Mathematica. I have a text/string, let's say sentence="hello world!", and I would like to ...
1
vote
1answer
38 views

Compile string cases into list

I have a html formatted string: ...
4
votes
3answers
152 views

rule-based deletions from string list

I have a list of strings: lis = {"a","b","c","12","d","q","r","X","s"} I'd like to delete list members starting with "X" moving backwards through the list from "...
0
votes
1answer
47 views

Convert input word into vector matrix

I wold like some help of converting an input (word or number or mix) into a single row vector, such as the following: If input is ">DAVID123<" I want it to be as {>,D,A,V,I,D,1,2,3,<} where ...
1
vote
3answers
63 views

joining elements of a list by rule

I am trying to generalize the responses kindly provided to my question posted here: to StringJoin adjacent elements only when the second element begins with a designated character such as "(" ...
1
vote
1answer
32 views

InputField with a symbol’s name [duplicate]

Suppose I have an InputField of type String wherein I want to enter a symbol name that I want a later Button to assign values to. That button would then do something like: ...
4
votes
3answers
136 views

merging certain list elements

I have a list of strings, some of which are all upper case, and some mixed upper and lower, and some are digits with commas: ...
3
votes
2answers
84 views

Construct a function that maps strings to functions

The main question is the last 5 lines (including codes) of this article. A[x_, y_] := Evaluate[ToExpression["x^2+y^2"]] A[3,4] Then the output becomes ...
7
votes
3answers
151 views

Creating rule-based sublists

I have a list each element of which consists of a list containing two strings and two integers: ...
5
votes
2answers
147 views

Convert String to Integer from a huge string database in a very fast way?

I have a huge string database with the form such as {{position},{1,2,3,4,5,..}}, and I want to convert such database to Interger data in a very quick way. In the following example, I created a ...
8
votes
1answer
331 views

How to find multi-word synonyms?

I’m looking to write a semantic distance function for phrases (5 words or less) that can map multi-word synonyms together. My domain is e-commerce fashion - here are some required examples for a ...
1
vote
1answer
33 views

Difficulty in generating an input text file

I am preparing the Ansys input file in Mathematica, It works completely fine with text, but the moment when I input some numbers I am getting some error. How to overcome this? ...
1
vote
1answer
35 views

How to interpret a string as a multiline cell of expressions

I need a string like the following: "2+2 \"Hello world\" 3+3" to be evaluate like 2+2 "Hello world" 3+3 Note that ...
2
votes
2answers
122 views

Add a suffix to the end of every number in a string [duplicate]

I have some polynomial e.g. $2x^2 + 3x + 4$ In Mathematica I can define this, and convert it to a string simply enough ...
3
votes
1answer
75 views

Data in Atom Form

I am loading a dataset into Mathematica and the format is always recognized as an Atom String: DS[All, 4] ...
1
vote
2answers
48 views

Restrictions as string to expression in region plots

I'm trying to build a function that generate a string of restrictons to pass on to a region plot with ToExpression, but I think it fails to pass the plot variables. ...
7
votes
0answers
73 views

Repeated string pattern: difference between the FrontEnd and WolframScript?

This code works fine in a string based interface like WolframScript or Mathematica Kernel. Run this through a string based interface ...