Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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

0
votes
0answers
4 views

Convert Math in Text Form to LaTex Form

I have the following math as txt file: text = {"aᵢ₁β₁ + aᵢ₂β₂ + ... + aₙ₁βₙ = bᵢ"} Is it somehow possible to convert it clean LaTeX Input ? The Goal: I want to ...
2
votes
2answers
10 views

Delete Consecutively Repeated String

I have the following text: text = {"hello","hello","hello","c","a","e","e","hello","hello"} Now I would like to do the following: Delete every string that is "...
1
vote
3answers
19 views
3
votes
0answers
65 views

WordCloud Produces strange squares

I am trying to make a wordcloud from this txt file: https://ufile.io/dqhyd Source: How to delete certain words from a word cloud in mathematica? ...
1
vote
1answer
37 views

Excluding some words in string patterns

I'm working on a program that deals with 'part-of-speech tagged' strings such as "I_Pronoun am_Verb a_Determiner human_Noun". What I want to do is replace each verb ...
8
votes
1answer
90 views

Lexical scanning and parsing in a toy language

I'm trying to do lexical scanning and parsing in a toy language. One with just functions (of the form $f(a,\,b,\,c,\,...)$, ended with semicolons) and special tokens (such as ...
10
votes
1answer
179 views

OrderQ with string arguments

I don't find these results consistent: OrderedQ[{"a", "A"}] True OrderedQ[{"a2", "A1"}] False Is there any ...
4
votes
1answer
65 views
2
votes
1answer
26 views

Character Encoding Problem with ReadList

I have a .srt file (subtitle file) with the following text: Chapitre 1 : Systèmes d'équations linéaires et matrices However when I import it into Mathematica, using: ...
3
votes
1answer
61 views

Rewriting Text-blocs

I have three sets of text blocs (actually many more...) which show part of a complete text. However the partitioning of the original text was not done correctly as some sentences were split between ...
3
votes
0answers
63 views

Match Polish letters

I am quite confused about the following cases, in Mathematica 9.0.1.0: LetterQ["ł"] StringMatchQ["ł", WordCharacter ..] The first case gives ...
10
votes
0answers
84 views

What changed in String handling between 11.0 and 11.3?

I was trying to optimize some String-handling code here using my standard trick of converting it to a list of bytes first and using basic list operations instead of ...
0
votes
3answers
170 views

How to scramble a string of text?

How to implement foo function which works like this: foo @ "abcdef" "fdbace" Steps: <...
1
vote
1answer
39 views

Simple way to apply a rule (from list of rules) based on the presence of the a rule key within a string

If I have some strings eg: str1 = "12-26b-14a"; str2 = "12-21h-14"; and I want to replace the string with a value based on the following rules: ...
4
votes
3answers
120 views

List rearrangment with joining of strings

I have a list of strings: lis = {{"a","b","x"},{"d","e","y"},{"a","b","z"},{"d","c","x"},{"a","b","w"}} I would like to use StringJoin on the last elements where ...
14
votes
4answers
2k views

What stopwords list is the Wolfram language using?

The documentation of DeleteStopwords only says that it "uses a standard, built-in list of stopwords". So what is it exactly? Update Now that it is said "standard"...
1
vote
1answer
29 views

RegionPlot: building a list of inequalities

I have a function like this: Myfunction[x_,y_]:={Max[1, Min[x, 2]], Max[1, Min[y, 2]]} and I need to do a RegionPlot like ...
3
votes
2answers
79 views

How to remove adjacent date strings in a list?

Given a list as list = {"2018-9-1",1,2,3,"2018-9-2","2018-9-3",4,5,6,"2018-9-5",7,8,9,"2018-9-6","2018-9-7",10,11,12,"2018-9-8",13,14,15,"2018-9-9",16,17,18} or ...
11
votes
3answers
390 views
0
votes
1answer
43 views

Joining strings in FrameLabel [duplicate]

I want the $ x $-axis of this plot to be $ \tau/\alpha_e $ without the "+", but I'm unable to do this without Mathematica putting the $ \alpha_e $ to the front of the string. ...
13
votes
3answers
405 views

Generating a pattern from user-defined rules

I want to generate a list of $L$ and $S$ according to the following rule: upon each iteration, replace $S \rightarrow L$ $L \rightarrow LS$ Such that, starting with $L$: $ L \rightarrow LS \...
9
votes
4answers
223 views

How to replace numbers in a string?

I have a long string list: ...
8
votes
2answers
231 views

Deleting certain integers from string list

I have a list of strings: lis = {"a","1","b","2","c","3","a","d","4"} and would like to get: ...
2
votes
1answer
33 views

Matching combinations of StringExpressions and general patterns i

Is there a clean way to match patterns that combine general patterns and ?StringExpression For example, Cases will not match ...
5
votes
2answers
166 views

Split up word pairs in string based on semantic textual analysis

I have several hundred sentence-strings with joined words. They were extracted from a text (and are in sequence). Here is an example of one: ...
2
votes
0answers
35 views

How to render an emoji? [duplicate]

Is there any way to get Mathematica to render emoji's from unicode strings? For instance, ":1F600" should be 😀but it renders as an "oulinded question mark": Also, ...
3
votes
1answer
46 views

Inconsistent behaviour using string with superscript as label

This might be a silly question, but actually I lost a bit of time to figure out what I was doing wrong and now I want to understand better. Moreover, I'm not sure if the behaviour I see is a bug or ...
2
votes
1answer
40 views

How to specify optional string parameters in a function signature and identify the pattern

As a newbie, I've got a rather simple question. I would like to define a function that accepts one of a few possible strings. I.e., I wish to do the following. ...
5
votes
0answers
40 views

Pattern for string that does not contain x, constrained to shortest matches only [duplicate]

I need a pattern for a string that does not contain a specified string, while at the same time respecting the mandate to match only shortest sequences. For example strings bracketed by ...
1
vote
1answer
50 views

Is this decryption function idiomatic?

This is my first non-trivial Mathematica notebook, which I wrote for a cryptology homework. It encrypts/decrypts strings using an affine cipher. Is the code readable/idiomatic? How could it be ...
4
votes
1answer
111 views

Jaro distance in MMA

I'm trying to program Jaro distance as requested by this page I've done the following code that works well for the next two pairs ("MARTHA", "MARHTA") and ("DIXON", "DICKSONX") but when I try with ("...
0
votes
0answers
33 views

How should I import list of results with scientific numbers so they can be used for further calculation?

I have a file, listOfResults.txt, consisting of many rows of which the following is an example: ...
0
votes
0answers
64 views
0
votes
2answers
63 views

How to properly write fraction in style

I would like to write the following for the legend of a curve : $$ Theta = \frac{\pi}{2}$$ Where the value $\frac{\pi}{2}$ is actually in a variable named $Theta$ (same name as the text on the lhs ...
1
vote
2answers
38 views

Changing the style in a list

I have the following list, l={{"a", "b"}, {"c", "d"}} I was wondering how can I convert it into: output: {"ab", "cd"}
0
votes
1answer
65 views

Generating list of labeled string [closed]

I want to generate a table that gives the following output: output: {"x1", "x2", "x3", "x4", "x5"} I have tried: ...
2
votes
4answers
117 views

Splitting a binary number into smaller parts and converting each smaller part back to decimal

This is my first Mathematica post and I would be obliged if you could be patient with me. I have the following large binary number $1111010010001001100011010101111110000101101110110011100101$ which I ...
3
votes
2answers
143 views

Deleting unwanted spaces in a list of string

I have a badly structured data and I need to clean it up, suppose I have the following list: l={{"a","b","c"},{"e"," f","g"},{" a"," b"}} As you can see they ...
6
votes
2answers
182 views

Select UPPER CASE list items with spaces and punctuation

I have a sample list that includes people's names in Title Case, and their companies in UPPER CASE. ...
11
votes
3answers
300 views

StringContainsQ And

I'm looking to test whether a string contains all substrings in it, independent of each substrings location. For example: ...
1
vote
1answer
46 views

Symbol Level pattern matching and rule replacement

I want to parse a Mathematica Notebook to get some information regarding the relative use of symbols. So first things first: ...
9
votes
3answers
446 views

Number of capital letters

I am interested in counting a number of uppercase letters in the text. I do it in the following manner. ...
0
votes
0answers
33 views

Limiting scope of StringPattern to first match for efficiency?

I have imported a Mathematica Notebook and assigned it to the variable file. In addition, I have gathered the strings corresponding to all Wolfram Language symbols:...
0
votes
1answer
49 views

StringPattern: Not one of pattern?

I have read in a Mathematica notebook and have assigned its content to the variable file. I have created the Strings corresponding to Wolfram Language symbols as ...
3
votes
1answer
79 views

Splitting a text file into smaller text files by line numbers using Mathematica

Is it possible to split a large text file into smaller files by line numbers in Mathematica?
2
votes
1answer
42 views

DeleteCases not working as expected

I am trying to reproduce the example of Data Cleaning from here. I had to make a slight change in input 13 to ...
3
votes
2answers
34 views

How to return a default value if no match is found in search of string

Suppose I have a string like "a-1_b-2_c-3_d-4" with numbers, labels, and separators, and I want to get ...
0
votes
0answers
22 views

create a list with common head [duplicate]

How to create a list like below by Table #& or others? j1, j2, j3, j4 ... j15 ...
1
vote
0answers
42 views

How to write a power using `WriteString` function

I have a solution of an equation: aa = N[Rationalize[g6[[3, 2]], 0], 16] (* Out: 2.691607147352649*10^-6 *) I want to save this result in a file using ...
0
votes
0answers
48 views

How to get rid of parentheses when importing a MATLAB expression

How can I easily correct this data sequence from MATLAB to one readable in Wolfram Mathematica? ({0,1},{0.1,2.3}) The problem is the 2 outer parantheses ...