Skip to main content

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
6 votes
3 answers
241 views

How to Pick Out Strings of a Specified Length

Suppose I have the following edge set: ...
user42700's user avatar
  • 1,773
2 votes
3 answers
147 views

How to Control StringContainsQ [duplicate]

I have the following code ...
user42700's user avatar
  • 1,773
2 votes
1 answer
37 views

StringJoin fails in .m

Do[( ND$T$thr[j] = j; ND$T$thr[j] >> "test_" <> ToString[j] <> ".dat"; ), {j, 1, 3}] This works without issue in a ...
Noldig's user avatar
  • 143
3 votes
3 answers
107 views

Extract doi from a text string

I have a large list with bibliometric information including the doi like this example: ...
M.A.'s user avatar
  • 731
4 votes
3 answers
363 views

How to express the notion of "from "a" to the nearest "z"" with patterns?

If I compute this: StringCases["abczabvncz", "a" ~~ __ ~~ "z"] It yields: ...
Red Banana's user avatar
  • 5,411
1 vote
1 answer
72 views

All possible tuples satisfying conditions

Let $\beta = (\beta_1, \beta_2, \ldots)$ be any given sequence of non-negative integers with all but finitely many $\beta_i$ zero. I want to collect all possible tuples $\beta^{\prime}= (\beta_1^{\...
Anantadulal paul's user avatar
0 votes
2 answers
91 views

Is it possible to have ToString operate on an expression containing Prefix (@) ? for example exp = [email protected]

ToString[exp] results in the string form of the evaluated form of exp when exp contains Prefix (@), such as when exp is an email address. How can such an expression be converted to a string?
user96574's user avatar
3 votes
5 answers
180 views

Importing Specific Data from a Text File

I am quite new to Mathematica. I have a text file that upon importing has a repetitive structure with characters included. I need to extract only the following in numbers only (no letters, dash lines, ...
LollyPop's user avatar
5 votes
4 answers
237 views

Select elements from a list based on alphabetical order criteria

I have this code to generate the anagrams for a 6 letters word: ...
Rodrigo's user avatar
  • 1,534
2 votes
0 answers
67 views

How to convert the <table> element into Grid

I got the html source code for this element for this page in Wikipedia: ...
yode's user avatar
  • 26.9k
0 votes
0 answers
49 views

How to convert RowBoxes into list of math expressions?

I have following RowBox which represents Step By Step solution of undefined integral ...
nnarek's user avatar
  • 1
0 votes
0 answers
33 views

Coverting .nb file code content to string type using NotebookImport

For my work I need to import the notebook and get all the contents from the code cell. For this task I chose ...
ordenarion's user avatar
2 votes
1 answer
49 views

Intra-Symbolic Wild Card Pattern Matching

I have the following custom expression structure I am parsing: Theorema`Knowledge`Q$TM[ Theorema`Language`VAR$[Theorema`Knowledge`VAR$x$TM]] I already was able to ...
marie_antoinette's user avatar
3 votes
4 answers
173 views

Sort Column as a Row

I have a = {1, 2, 3, 10}; b= {2, 3, 4, 8}; t= Do[If[a[[i]]+b[[i]]>3,Print[a[[i]]],"No"],{i,1,4}]; 2 3 10 I need to get the result; t={2,3,10}
Alyasaa Jasim's user avatar
7 votes
3 answers
266 views

Replace number in string with ? and /;

I am trying to make the following: StringReplace[{"A4", "A#3"}, {"A" ~~ x_ -> "B" ~~ x}] This should replace ...
Red Banana's user avatar
  • 5,411
3 votes
0 answers
57 views

How to improve Burrows-Wheeler Transform performance?

I have implemented the Burrows-Wheeler Transform as below: ...
flinty's user avatar
  • 25.6k
0 votes
0 answers
50 views

How to convert LaTeX to expression without interpreting variables as products?

I need to convert some LaTeX code to mathematica expressions. So far I have used ToExpression["ab", TeXForm] yielding ...
Suppenkasper's user avatar
1 vote
1 answer
43 views

Why is StringSplit dropping empty entries? [closed]

I am parsing a CSV and whenever the trailing records are empty: StringSplit[",2,,4,,",","] I get: {"2&...
user13892's user avatar
  • 9,523
1 vote
0 answers
133 views

Butterflied Strings Shortest Character Solution

The shortest character solution for Butterflied Strings on Wolfram Challenges according to the CODE CHARACTERS functionality is 40. I have a solution with 42 ...
Navvye's user avatar
  • 171
0 votes
1 answer
51 views

Pattern matching with DeleteCases

I'm using Mathematica 14.0 and I'm having a pattern match problem with DeleteCases. The example below illustrates the problem. I define a test string followed by two patterns that both nominally match ...
jparm's user avatar
  • 1
3 votes
2 answers
107 views

Writing Mathematica code for putting in commutation relations in a string

I am trying to write a mathematica code to accomplish the following: For a given $n$, consider $(ab)^n$, which is a string of the form $\underbrace{ababab...ab}_{n\text{ times}}$. I want to replace $...
Ryan Hendricks's user avatar
1 vote
1 answer
63 views

Compressing a file's name string

I was working with files where each name records a lot of information about what is in its respective file and wanted to compress it a little bit. So I wanted to change it's 'base'. And I noticed that ...
Teg Louis's user avatar
2 votes
3 answers
229 views

The problem of matching consecutive cross-line strings

I have a file named "s0.log",There's a lot of this structure in there: You can see that the strings "Alpha occ.eigenvalues --" and "Alpha virt.eigenvalues --" will be ...
我心永恒's user avatar
  • 1,572
1 vote
0 answers
65 views

Why is SequencePosition or SequenceCases so slow on large lists?

I observed that SequencePosition or Sequence Cases on a list of around 60'000 digits is so slow that I had to sort out to string pattern matching. Is this normal behavior or should Wolfram have a look ...
markilux's user avatar
  • 121
3 votes
5 answers
284 views

How to select elements from a list of strings?

...
Tugrul Temel's user avatar
  • 6,233
3 votes
1 answer
122 views

Behaviour of `ToExpression` inside a function definition

I want to create a function that takes in an array of unknown size and do some index operations on it. I am using strings to construct the expression and then trying to use ...
Himanshu Chaudhary's user avatar
3 votes
5 answers
146 views

Sorting logic and generation of letter sequence

In the context of experimental designs, it is common to generate the various treatment names to build the factorial design table. The table of the 2^2 design reads : For the 2^3, the table reads : ...
Jocelyn Minini's user avatar
2 votes
1 answer
60 views

FromLetterNumber and "" bug or intended behaviour

DigitQ behaviour appears consistent "" is treated as 0 by DigitQ` ...
IntroductionToProbability's user avatar
1 vote
1 answer
62 views

Difficulty using StringCases to obtain desired substring

I have extracted and stored some plaintext strings (derived from a pdfs) from the web that I wish to search for various values following certain text substrings that are different for different ...
Stuart Poss's user avatar
  • 1,893
2 votes
1 answer
67 views

RawBoxes in ClickToCopy adding spaces after escaped characters

I'd like to use ClickToCopy to display a matrix equation, and have its TeX form be copyable. I started with something like ...
srossd's user avatar
  • 260
4 votes
4 answers
278 views

From string to number

I have data such as, {{[Part(33.0, 34.0), Part(33.0, 34.0), Part(31.0, 32.0), Part(30.0, 32.0), Part(29.0, 32.0), Part(28.0, 29.0), Part(28.0, 29.0)]}} as text ...
rani's user avatar
  • 365
1 vote
1 answer
86 views

Nicer display of output with TeXForm

I am summing some terms by first transforming it to TeXForm. Example: Sum[TeXForm[x^i],{i,1,50}] I want to break the line in ...
BabaYaga's user avatar
  • 1,897
1 vote
0 answers
36 views

Change specific elements of a list [closed]

I have currently looking to change specific elements of a list. I saw that you can apply a fonction to an element if you know it's position as shown in this question : Apply function to specific ...
Student_Number_249812341's user avatar
1 vote
0 answers
27 views

Can I limit the mouse prompt position in InputField? [duplicate]

I wrote the Manipulate code in double quotation marks in InputField. Manipulate[str, Style[Control@{str, " "}, 20]] Above, I can create a prompt status ...
Milk's user avatar
  • 1,728
4 votes
2 answers
753 views

Largest integer between 1 and 1000 with no letter "n"

This problem is easy to solve logically - try it for fun if you want before you run the code and see the answer. ...
Vitaliy Kaurov's user avatar
0 votes
1 answer
70 views

How do I copy what I enter into 'InputField' without any computational processing?

I made an InputField where I input the quoted sentences inside. And I set InputField to copy every time I run it. ...
Milk's user avatar
  • 1,728
2 votes
0 answers
72 views

DigitQ, LetterQ, UpperCaseQ, LowerCaseQ on empty string

Is this a bug or I am missing something? #[""] & /@ {DigitQ, LetterQ, UpperCaseQ, LowerCaseQ} ...
azerbajdzan's user avatar
  • 19.9k
10 votes
9 answers
488 views

Element by element concatenation of two string lists

I have two lists of strings: month = {january, february, march} year = {2013, 2013, 2013} I want to concatenante these element by element with the final result of ...
Todd Dixon's user avatar
3 votes
3 answers
87 views

Convert a string with $N^2$ entries to a rank-$N$ matrix

Suppose we are given a set of numeral data like a string that consists of $N^2$ entries, say $N$ is very large (here $N=8$ for simplicity, but $N$ can be $10^8$...) ...
zeta's user avatar
  • 251
3 votes
1 answer
93 views

Problems that occur when converting to PDF files using NotebookPrint

I made a string expressed in StandardForm format. ...
Milk's user avatar
  • 1,728
3 votes
2 answers
177 views

Select a subset in the bit-strings with even 1s overlapped - thank you

Model 1 Consider the permutation list of 4-bit-strings: list = Permutations[{0, 0, 1, 1}, {4}] which outputs: {{0, 0, 1, 1}, {0, 1, 0, 1}, {0, 1, 1, 0}, {1, 0, 0, ...
wonderich's user avatar
  • 923
4 votes
1 answer
227 views

How to execute a String code in the form of StandardForm?

How to execute a String code in the form of StandardForm? I want to get execution results for strings of various forms. For this, I used ToExpression. ...
Milk's user avatar
  • 1,728
3 votes
1 answer
182 views

How to convert the string "A^0" into the expression Superscript[A,0]?

I'm looking for a procedural way to define a symbol for a variable, based on a string. For instance, ToExpression["A^B"] gives us ...
JuanC97's user avatar
  • 612
1 vote
1 answer
77 views

Two Subscript/Superscript questions

In mathematica code, I have a table of quantities that involve subscripts and superscripts. I need to put short text titles in the first row of the table. Suppose I have index1="A", index2=&...
matrixbud's user avatar
  • 435
0 votes
1 answer
60 views

Exact rules applied by StringReplace when two substrings are to be replaced?

I am interested in the case when we apply StringReplace to a string searching for two substrings where one is contained in the other and we define different ...
tell's user avatar
  • 320
4 votes
6 answers
444 views

Convert integer to words of specific length

Assume we give the value from 1 to 26 to alphabets a,b,...,z. Now given an integer ($n$) i like to generate words of specific length ($l$) that sum of them equals $n$. For instance, if $n=10$, $l=3$; <...
asad's user avatar
  • 848
1 vote
3 answers
568 views

Can colors be included in strings?

Colors are displayed in output like squares of the corresponding color. Say, if input is Blue, the output will be a blue square. I would like to use this in a ...
მამუკა ჯიბლაძე's user avatar
2 votes
4 answers
138 views

How to transform the data in the following way?

Consider the following data: ...
John Taylor's user avatar
  • 5,877
1 vote
0 answers
124 views

Convert a string of Python expression into Mathematica expression within Mathematica

While there are many ways to convert a Mathematica expression into other Languages, I was wondering if there is something reverse for Python. There are some discussions in Python groups, but I am ...
BabaYaga's user avatar
  • 1,897
1 vote
1 answer
52 views

How do I select a long part of a complicated expression between two symbols inserted for the purpose? [duplicate]

I want to select a long expression that spills over into many pages. Using mouse and cursor makes it go really fast. Is there a way I can insert some characters and instruct Mathematica to pick up ...
Quasar Supernova's user avatar

1
2 3 4 5
26