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 tagged [string-manipulation]

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

2
votes
1answer
42 views

Have a String of letters with different font sizes - LineLegend

There's a Plot whose legend has symbols with subscripts and regular text. The words that have subscripts appear to shrink in size and looks out of place in comparison to the rest of the legend. Was ...
3
votes
3answers
81 views

Convert Latin to e.g Gothic

Sorry for the very simple question but I can't seem to find an answer anywhere. I have a list of Latin letters, e.g. {a, b, c, d...}. I want to convert them to the corresponding Gothic letters. How ...
4
votes
1answer
28 views

Longest Repeated Substring

Is there a solution in Mathematica to the problem of finding the longest substring of a sequence that occurs at least twice.For example {1, 2, 3, 4, 5, 2, 3} has ...
2
votes
1answer
53 views

How to Text justify that includes StringSplit and MapAt in it?

I am preparing a practical class of physics in which I need to justify the following text that is very extensive. But when I use StringSplit or ...
4
votes
1answer
68 views

String Join but not fully

Suppose I have the following string list: l={{"a","dog"},{"the","pen"}} how can I turn this to {{"a dog"},{"the pen"}} I ...
0
votes
1answer
35 views

StringSplit with SubscriptBox

My code has a problem ...
3
votes
2answers
65 views

Having Mathematica replace DOS line breaks with UNIX in files

Say I have a file named "Silly.tex" which has \r\n line breaks. Is there a way to get Mathematica to convert it to only have \n line breaks? You can find such a file with DOS line breaks at: https://...
3
votes
1answer
55 views

How to change node color in .dot file using pattern matching?

For example I have a dot file that describe a decision tree or binary tree In the file, the color of node is always gold, so I try to change it according the number in ...
5
votes
2answers
214 views

Rearrangement of lists of strings

I have a list: lis = {{"abc","def","ghi"},{"jkl","mno"}} and wish to get: res = {"abc def ghi","jkl mno"} This: ...
2
votes
1answer
56 views

How to write single slash in string programmatically

Consider the function: unicode[numericLetters_List]:=StringJoin@Reverse@Cases[numericLetters,x_:>If[x!=" ","\:"<>x,x]]; now ...
1
vote
1answer
49 views

Resolution of string lists to smaller components II

Some weeks ago, I posted a question which involved creating string pairs from a list of string elements. One of the answers posted (by Kuba) worked very well until I found an example where it didn't. ...
1
vote
3answers
78 views
2
votes
1answer
51 views

How to refer to a character group without ambiguity in a regex?

Suppose I want to realize a replacement in a string: "aabbcc11dd ee" -> "aabbcc112dd ee", I can use a regex like this within ...
1
vote
1answer
41 views

Selecting elements using two lists

I made the following list: ...
2
votes
1answer
41 views

Logically equivalent Through expressions, but one produces an error

I have a list of three lists of strings. Thus, MatchQ[{{__String}, {__String}, {__String}}] is True. I would like to extract all ...
7
votes
4answers
743 views

Add a space after a ending dot of a sentence

How can I add a space after the ending dot of a sentence? So dots like in "1.2" should be unaffected. Also if there is already a space, then there should not be a ...
4
votes
1answer
227 views

Delete all French stopwords [duplicate]

I have a list of french stopwords: ...
6
votes
1answer
436 views

A strange verb from Mathematica's WordList

The first word returned by WordList["Verb"] is "aah", even though I think it actually an interjection, I still wonder whether ...
3
votes
2answers
121 views

Merge associations with the same keys, same in a sense by user's definition

I know that it is the standard functionality of Merge to combine the values of the same keys among associations. Now I would like to deal with a situation in which,...
4
votes
1answer
127 views

Convert Unicode to Math Input

Any Ideas how I could convert unicode to Mathematica Input ? For instance : I have the following Unicode: test= {"a", "\\:1d62"} So here I would like to convert ...
1
vote
1answer
59 views

Convert ASCII Characters to Mathematica Input Form

I have the following pure ASCII character list: ...
2
votes
1answer
92 views

Convert Math in Text Form to $\LaTeX$ Form

I have the following math as a text file: text = {"aᵢ₁β₁ + aᵢ₂β₂ + ... + aₙ₁βₙ = bᵢ"} Is it somehow possible to convert it clean $\LaTeX$ Input ? The Goal: I ...
3
votes
2answers
127 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 "...
2
votes
3answers
236 views
4
votes
0answers
71 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
40 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 ...
11
votes
1answer
126 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 ...
12
votes
1answer
206 views

OrderedQ with string arguments

I don't find these results consistent: OrderedQ[{"a", "A"}] True OrderedQ[{"a2", "A1"}] False Is there any ...
4
votes
1answer
75 views
2
votes
1answer
31 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
66 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
66 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 ...
12
votes
0answers
93 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
187 views

How to scramble a string of text?

How to implement foo function which works like this: foo @ "abcdef" "fdbace" Steps: <...
1
vote
1answer
42 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
125 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
32 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
87 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
398 views
0
votes
1answer
46 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
412 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
277 views

How to replace numbers in a string?

I have a long string list: ...
8
votes
2answers
234 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
35 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
178 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
38 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
47 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
45 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
43 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 ...