# Questions tagged [string-manipulation]

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

1,102 questions
Filter by
Sorted by
Tagged with
56 views

### automatic extracting number from a text with given signs

I am trying to get a number from a plaintext with the staring sign of "Nho xanh không hạt" and ending sign of "đ" automatically with different method but it doesn't work. In detail,...
122 views

### How to display warning message inside manipulate?

Using the code shown, Reynolds number is calculated for given parameters. Is it possible to display a warning message to the user if a parameter is outside applicable range? e.g., if the fluid ...
189 views

### List all substrings of a number

Need some help listing all substrings of a number X=219 The output should be Output= {2,21,219,1,19,9} Order does not matter for this problem Any help is appreciated
45 views

### Can't Export string made with StringForm?

This works. It returns "acb". StringForm["ab", "c"] This doesn't work. ...
50 views

### Grouping together same exponent terms in a multivariate monomial

This is a rather simple question but for some reason, I am spending too much time on this. Suppose I have a monomial in 4 variables, each raised to some linear combination of 3 exponent variables: <...
54 views

### Inverse Dictionary Lookup

Example: Using WordDefinition: WordDefinition["surreptitious"] ...
51 views

### Map, EvenQ, and the correct syntax [closed]

Using If and EvenQ defines a pure function, which when applied to an integer, computes its square when the integer is even, and ...
36 views

### StringReplace with RuleDelayed to replace each integer digit character in the strings with a digit that is 1 less than the number

Use StringReplace with RuleDelayed to replace each integer digit character in the following strings with a digit that is 1 less than the number represented by the digit character. (Hint: Use ...
39 views

### StringExpression: Give all pairs of identical characters in the string

While going through StringExpression (https://reference.wolfram.com/language/ref/StringExpression.html), unable to figure out the following: Give all pairs of identical characters in the string: Input:...
207 views

### using StringReplace and StringPattern to convert exp(...) to Exp[....]

I am looking at a file generated by another CAS. I'd like to convert it to Mathematica syntax. Only issue is how to convert exp(....) to ...
522 views

### String permutation

I have a string "abcd". Is there any way in Mathematica such that when I apply some exchange operator $P^{ab}$ it gives me string "bacd"? Edit: After reading answers I felt like I ...
138 views

### Fill in the StringBlank

I have a string that has blanks marked by a marker; (in this case, an underscore): "f_ath_r". I can execute the following command to get the word. ...
64 views

### Extending NumberForm

I'd like to define a function, call it NumberF, that takes a real number n and two naturals l...
114 views

### Sublist creation, splitting and joining

I have a not very usefully-formatted string list and I would like to create certain sublists from it. ...
179 views

### Extract specific string from a list of strings

My question is similiar to previous questions (see here or here), although the issue is maybe somewhat more complicated: I have a list with strings like this: ...
48 views

### How can I convert the inverse hyperbolic function I defined and built-in inverse trig functions to TeXForm the way I prefer?

In Mathematica,the inverse hyperbolic functions are displayed with the prefix "Arc" like "ArcSinh[]", which I thought incorrect and misleading. Since the hyperbolic angle is ...
93 views

### Using StringExpression in a string list

I'm trying to search in a list of strings those who match a pattern. But it seems that StringExpression in functions such as ...
38 views

### How to join two partially overlapping strings without duplication?

I have this list of strings; first string overlaps with the second string, and second string overlaps with the third string. I want to combine those into a single paragraph. ...
81 views

### Removing Commas From Numbers in Datasets Expressed as Strings and Converting To Numbers

The following code generates a dataset from a table within a webpage: ...
58 views

### Getting a symbol from a string without it being replaced by its value?

Consider the following code running on a fresh Mathematica session with no symbols defined: p[s_String] := Protect[s]; p["x"] This doesn't do anything ...
144 views

### Strings are constants? (Kind of output hack to circumvent that needed)

I have an "internal" notation (since some stuff is equivalent and can be manipulated via patterned expressions in the function F), say ...
33 views

### $P=QRS$ decomposition of given list-3-unordered list

This is an extended version of my previous posts, $P=QRS$ decomposition of given list, P=QRS decomposition of given list -2 -unordered list Inspired by @Bill, and considering multiplicities, ...
121 views

### How to Copy a number from a string

I want to copy a section of a string, which lies between two fixed string sections. How to do it? For example if the string is "...\abcd124\145@cvdf\efgh...". How to tell Mathematica to copy ...
45 views

### P=QRS decomposition of given list -2 -unordered list

This is an extended version of my previous post, $P=QRS$ decomposition of given list Based on the answer and comment of @Bill, Form all permutations of P. Form Q as the first element of each of those,...
85 views

### $P=QRS$ decomposition of given list

This is an extension of my previous post $P=QR$ decomposition of given list Now for this time, I want to decompose arbitrary list $P$ into three pieces for ordered or non-ordered cases. Based on the ...
52 views

### $P=QR$ decomposition of given list

For given arbitrary lists, I want to decompose the list into two parts and assign individual lists. i.e., I want to decompose, $P=QR$. And I can think of its decomposition in two cases: ordered and ...
73 views

### Creating new variable names, Symbol or ToExpression

One can create new variable names by Symbol : In Table[Symbol["x"<>ToString[i]], {i,1,5}] Out {x1,x2,x3,x4,x5} But it is also possible to ...
44 views

### How to Set Text Format by User-Defined Function with Input as String

I have simple but annoying problem here. I guess it occurs to many Mathematica users. The thing is that I wish to define a function to format the text in Mathematica. Yet, I don't know whether it is ...
39 views

### Converting HyperInt Hlog to Polylogtool G [closed]

how do I replace efficiently HyperInt's Hlog (in maple expression) {Hlog(Y,),Hlog(X, [1, -Y + 1]),Hlog(X,[1,1,1])} in an expression into PolyLogTool G: {G[1,Y],G[1,-Y+1,X],G[1,1,1,X]} Basically, ...
87 views

### how to change list of some scalars into vectors?

I have a pair of equations f= {eq1,eq2} that are (x,y) dependent. I take derivative by (x) and (y) for each equation, for example, Grad[f, {x, y}] . {1, 1}] and ...
61 views

### ToString with delayed replacement [duplicate]

I want a toString method that replaces each occurrence of f[x_]. ...
344 views

### When should I use <> instead of ~~ to join two strings?

Both <>, i.e. StringJoin and ~~, i.e. ...
218 views

### Make matrixes with numbered name

Suppose I have two matrixes M1 = {{0, 0}, {0, 0}} M2 = {{0, 0}, {0, 0}} Now I wanna have $N$ matrixes in this form called M1, M2, M3, M4,...MN How to code to ...
159 views

### Copy clipboard content to mathematica notebook - line break symbol changes

There are 3 kinds of line breaks \r \n \r\n For windows, \r\n is standard. Suppose that there is a file called document.txt, using \r or \r\n as line breaks. Suppose that I open document.txt with a ...
61 views

### Palindrome by deleting a character

I need to find a list of strings with input string length n for whom are palindrome by deleting a character from it . The strings are stored inside function ...
59 views

### Find all substrings from a string by deleting characters from it

Problem Description : I need to create all substrings from a string by deleting letters from it without re-arranging the rest of the letters. For example, "us" is a substring of "...
43 views

### Split a String by minus and zero

How can a String like 0.0002230.0012730.000296-0.0014380.0011270.0014690.001457-0.001017 be converted to ...
32 views

### Insert string elements to an array

(Minimal example) I'm dealing with the following array : ...
173 views

### Recursion in String Length of Roman Numeral

I am new to Wolfram language (Mathematica) programming, I have below problems. To summarise the problem : The input is a positive integer, and the output is a recursive list of the lengths of the ...
46 views

### How to make the third parameter optional and adding some condition?

I have a function as follows. The function has 3 parameters. Now I would like to make the third parameter i optional. So you call call it like ...
70 views

### Parse string to association

Here is a string, which I call data: ...
49 views

### Highlight text given String and String-Pattern

given a String: string = "the cat is on the mat" and given a String-Pattern ...
83 views

### How to convert Strings from Mathematica (UTF-8) to Linux with locale "de_DE.UTF-8"?

I want to do file system operations with a Mathematica program. I see, that Mathematica and my Linux operating system use different encodings. According to the unix command ...
687 views

### Is InternalStringToDouble broken in 12.3?

I believe InternalStringToDouble was the only way to fast convert string into numbers. Now in V12.3 it was removed: InternalStringToDouble["1"] ...
12 views

I'm trying to pad some binary and hexadecimal numbers using PaddedForm, and also to separate the digits into blocks of 4. For example, I'd like a number like ...
60 views

### how to delete the nth line in a multiline string?

How do I delete the $n$th line in a multi-line string. For example how would I delete the $2$nd line in the following string? ...
37 views

### Divide string only at line breaks [closed]

I have a very simple problem but don'tk now how to solve it. I have a string that looks like this: string="a b c d e f" I want to break it ONLY at the line breaks, i.e. I want to get a list ...
39 views

### How to return NumberString's after a certain word

I'm interested in the general operation of extracting NumberString's after a certain keyword. Here is a specific example Consider the string: ...