The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
1answer
32 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
52 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
35 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 ...
4
votes
1answer
95 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
26 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
88 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
84 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
82 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
38 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
104 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
42 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
35 views

Compile string cases into list

I have a html formatted string: ...
4
votes
3answers
151 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
38 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
60 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
31 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
132 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
82 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
150 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
136 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 ...
4
votes
0answers
80 views
+50

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. Here are some examples: “Red shoes” would be close to “Orange sandals” “...
0
votes
0answers
27 views

One input cell is giving two output cell [on hold]

I have an input cell, and I have some code there whenever I run this cell I am getting two out out cell as a results, I need it to be like a single output cell how to do this? ...
1
vote
1answer
32 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
34 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
103 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
72 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
46 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. ...
6
votes
0answers
67 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 ...
1
vote
1answer
48 views

Convert string to conditional operator

I have a RadioButtonBar with a selection x = None; {RadioButtonBar[Dynamic[x], {lt, le, eq, gt, ge}], Dynamic[x]} Once a radio button is selected, I would like ...
3
votes
1answer
42 views

Get subscripts of sum of expression and save each summand's subscript separately

I deal with expressions like A= a_i a_j a_k + a_i a_l a_m+ ... where the a_i notation is shorthand for Subscript["a",i] and all subscripts are integers. In this ...
0
votes
1answer
41 views

WriteLine[] not working once put into a function

I wrote a function that takes two strings, an integer, and an OutputStream, it's supposed to write to. The function is: ...
9
votes
4answers
239 views

How can one convert an expression to a string while keeping the quotation marks of strings that are part of the expression?

How can I for example convert {"a","b"} to "{\"a\",\"b\"}", so keeping the quotations marks.? I tried ...
0
votes
1answer
46 views

How can import more files simultaneously and clean them in Mathematica?

I would like to import three files in Mathematica (I am using the Import function[]) and try to clean them. I used ...
0
votes
0answers
36 views

relating Compress[] to information theory

I have a question regarding the Compress[] function. From my reading, Compress[] is based on zlib and should provide lossless compression. Given a string (call it test), I would expect that, from ...
1
vote
1answer
79 views

Defining functions from strings

Blank symbol (_) is moved when applying ToExpression to the following string: ...
1
vote
0answers
50 views

How can I handle box drawing characters?

I must generate files for windows batch scripting, modifying template files, es. ...
0
votes
1answer
80 views

How many symmetric words are in a string? [closed]

Determine how many symmetric words are in a given string. https://reference.wolfram.com/language/tutorial/WorkingWithStringPatterns.html
0
votes
1answer
48 views

ToExpression[ToString[x^2]] does not produce x^2 [closed]

ToExpression[ToString[x^2]] does not produce $x^2$, instead it gives $x$. Please explain. I actually wrote the following code and it gave the answer as 1. ...
3
votes
1answer
36 views

How to remove the trailing ` in StringForm[“Mean `1`”, 2.2]?

How to remove the trailing ` in the following? StringForm["Mean `1`", 2.2] produces Mean 2.2`
0
votes
0answers
92 views

Strip of all tags “Defer[…]” from a string expression

How can i remove all "Defer[...]" from the following expression ...
0
votes
1answer
54 views

Delete elements form a list with elements with strings and numbers

I am trying to create a list list2 removing elements from a list list. The structure of list...
2
votes
1answer
51 views

Using StringTemplate with TableForm [closed]

I have a table given by ...
1
vote
1answer
48 views

Change date format for different variants of SQL

Wrote this code to change MS Access variant of SQL date format to T-SQL, basically recognize dates delimited with pounds and change pounds to single quotes My Mathematica code is Pythonic, because I ...
0
votes
1answer
39 views

Count the number of words in WordList that start with a “q” [closed]

How can I create a subset of WordList[] that contains only the words that start with "g"?
1
vote
1answer
52 views

How to encode the character into UTF-8?

As we know the café is caf\xc3\xa9 after encode by UTF8: >>> 'café'.encode('utf8') ...
6
votes
2answers
424 views

Convert a huge txt-file into a dataset

My friend has this huge txt-log of sea levels. He wants to organize it into a dataset. After importing it this file a used StringSplit to separate it into rows, then to singular elements ...
1
vote
2answers
76 views

Function returning a pattern with condition - how to prevent condition to evaluate prematurely?

I figured it would be convenient to have a function that returns a pattern, that match equally nested brackets, of the specified type. Such a pattern is easy to create, but I get some error messages, ...
0
votes
0answers
29 views

How to join words in a list to form a single sentence? [duplicate]

If I have a list of words such as: {"If","I","have","a","list","words","such","as"} How can I join all the words in this list and for a single string sentence ...
-3
votes
1answer
47 views

Performing loop operation (average on lists of datas) of strings of datas [closed]

Lets say I have 100 CSV files of two columns data in each file, and I want to calculate the average of the 2nd column of each CSV file and then save all all these 100 averaged values in one CSV file (...
0
votes
0answers
42 views

Text with dynamic values

...