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

learn more… | top users | synonyms (5)

0
votes
0answers
11 views

Print joined string with variable superscript [duplicate]

I like to join some strings which I then like to print. A substring contains a number that I like to be printed in scientific format. An example to clearify: ...
6
votes
4answers
311 views

ToUpperCases based on the original string

Suppose I have a numberic string str = "1234567456"; and another string called nstr = "05eccead24"; I want to transform ...
22
votes
3answers
858 views

Typoglycemia text manipulation

I was just reading the Wikipedia page on Typoglycemia: ... readers can understand the meaning of words in a sentence even when the interior letters of each word are scrambled ... and wanted to ...
0
votes
0answers
40 views

Generate rule that replaces if string matches pattern

I have let's say a function f[x], but for x I pass a string. And I want to replace that string with a number, if that string ...
1
vote
0answers
45 views

How to declare variables with plus/minus sign as subscript/superscript?

I am pretty new to mathematica, so please forgive me if I ask any stupid questions. I want to create a vector $a^{+}=[a^+_{k-2},a^+_{k-1},a^+_{k},a^+_{k+1},a^+_{k+2}]$ and then do some symbolic ...
2
votes
1answer
62 views

Replace part on string in list

I have a list with string and integers and want to replace one word in the string with an integer. For Example if I have ...
0
votes
1answer
47 views

Keeping Stretching Brackets/Braces/Parenthesis in A String

Hopefully a simple one...Does anyone know how to preserve "bracket stretching" in a string. For instance, if I copy a formula and use it as a plot label or in any string the brackets revert back to <...
1
vote
2answers
66 views

fill in a table with some words letters

I have a list of words list={"ingenuous", "forgotten", "tree", "supercomput", "hundred"} How can I put the letters of each word in an element of a table such as ...
3
votes
1answer
120 views

Why the pattern match don't work as expected

When I try to figure out this problem,I write such code: ...
7
votes
1answer
285 views

How to split text without spaces into list of words? [duplicate]

What is the best approach to a problem like this in Mathematica? I can only manage this: ...
5
votes
0answers
39 views

The second escaped path breaks command execution

Due to a terrible chain of events I had to reinstall part of my software. Git among it, but a newer version. Something changed because earlier all four evaluations were giving me a version info: <...
0
votes
1answer
34 views

Import create evil invisible characters when import txt including ellipsis:“…”

I'm using Mathematica10.0.2 on Win7 suppose I have a txt file named test_Import_characters.txt(http://pan.baidu.com/s/1hsvy6xQ) which contains two lines of string example(copied from http://...
3
votes
1answer
277 views

Strange behavior of StringReplace, same expression evaluated differently

I have two expressions which are exactly same: StringReplace["in the next few days", {"in" -> "ffdsf"}] and ...
0
votes
0answers
28 views

Shortest[] didn't work for StringReplace for shortest consistent match if whiteSpace involved [duplicate]

This is a problem related to How to use StringReplace "from bottom to global"? The answer of @J.M. works well for "<...>" styles : ...
2
votes
1answer
56 views

StringSplit on comma but ignore commas in quotes [closed]

I'm importing CSV files and some of the fields include quoted text with commas as part of the field, rather than as a field separator. What is the syntax (or alternative method entirely) to import ...
2
votes
3answers
79 views

Parsing/validating CAS registry number identifiers

Mathematica includes a lot of curated information on molecular structure and properties available through ChemicalData and ...
3
votes
1answer
33 views

How to use Write[stream, expression] without automatic addition of next line character

I am writing a C code for solving a big set of differential equations. I am trying to use Mathematica to export some of the long expressions to C. I would like to know how I could use Write[stream, ...
3
votes
1answer
68 views

How to implement search patterns and take into account language statistics?

Patterns in Mathematica I struggle some with patterns while trying to extract words out of large texts. Let us say that I have a long text (Strindberg) that we can call ...
6
votes
3answers
193 views

Removing non-word characters in certain parts of a string

I would like to ask how I can remove non-word characters from a string, but only in certain cases. I have read this article, so I know how to get the words out of a string. My text is however a bit ...
2
votes
2answers
81 views

Generating a list of file names

I have set of files in the format 20160615-1-0.asc, 20160615-2-0.asc,... 20160615-5-0.asc etc. The following commands can List the file names at once which can be used to import later. ...
1
vote
0answers
29 views

Non-commutative concatenation of strings, keeping strings separate

I'm using strings as symbolic notation for non-commutative linear algebra and need to be able to concatenate without losing ordering and without combining the strings (in order to apply rules I've ...
6
votes
1answer
114 views

Error when combining Except, “*” and an additional character

Bug introduced in 5 or earlier and persists through 10.4.1 Anyone knows why ...
9
votes
2answers
213 views

Position and string patterns

I am trying to get Position work with patterns. I have the following code: ...
2
votes
1answer
62 views

Need help with making an interactive 3D plot

My main problem is to generate a manipulatable 3D plot, combining three functions and two of those functions depend on another variable Theta (which shall be the manipulateable variable). To explain ...
5
votes
3answers
186 views

Delete all strings that are prefixes of another string

I have a long list of strings and I'm trying to find a more efficient way of removing those elements that are prefixes of another: ...
0
votes
1answer
31 views

Count words and letters by using LetterCounts and WordCount

How can I count letters and words in the following "text", by using LetterCounts and WordCount? ...
2
votes
0answers
46 views

Getting “string expected” error when using the TIDES package

TIDES is a package that approximates ODEs using a Taylor series method (You can download it from https://sourceforge.net/projects/tidesodes/ ). First I call the package: ...
-1
votes
1answer
62 views

Turn binary number into string of words [closed]

I don't actually have any code for this, as I have no real idea how to do it. I have a large binary number combination that I know turns into some sort of string. How would I go about translating it?
6
votes
5answers
682 views

How to replace a space by a comma

in this expression = "{1 2 3 4 5 6 7 8}", I want to replace each space by a comma , to get ...
0
votes
1answer
72 views

insert comma between numbers [duplicate]

I have the following numbers rows and I want to insert a comma between the numbers? 6 7 9 51 64 68 79 102 116 128 148 155 184 202 273 283 292 1 7 8 10 52 65 69 80 103 117 129 149 ...
7
votes
4answers
197 views

Searching a phrase in all *.nb files

I have so many *.nb files in a folder. In one of them I have written a phrase, unfortunately I cannot remember that file. I am searching about it and the file in ...
3
votes
2answers
114 views

Replace non-zero elements with symbol

I have a very large matrix (tensor) in Mathematica with some zero and non-zero elements. I am interested in replacing the non-zero elements with some symbol or a 1 so that it is easier to view the ...
8
votes
1answer
128 views

What kind of pattern should I use with StringCases? [duplicate]

Consider the string str = "ABCaDEFbcABCdefDEF" I'd like to take out all substrings surrounded by the substrings "ABC" and <...
2
votes
3answers
146 views

What is an efficient way to pick out consecutive, same first-letter words from a list?

Taking a list of words, I'd like to pick out consecutive words that start with the same letter. The output should be a list of these pairs. The following is relatively slow: ...
12
votes
1answer
533 views

How to convert a notebook cell to a string retaining all formatting, colorization of identifiers etc?

I have an opened Mathematica notebook containing several cells. Suppose, I am interested in one of them -- it may contain a complete or incomplete expression (e.g. with syntax errors, highlighted ...
0
votes
0answers
20 views

strse error in string operation

When I using jSoupLink, I found strange behaviour First, I load jSoupLink and define linkList ...
2
votes
1answer
55 views

Why is head evaluation inconsistent in pattern replacement?

I noticed the following unexpected result: In[90]:= "foo" /. x_String -> Head[x] Out[90]= Symbol Why is it that Head[x] ...
1
vote
0answers
75 views

Numbers not treated as numbers

I'm apologize for the stupidity of this question, but I've run out of ideas. I have some data saved in a mx file. When imported, MM isn't treating the values as numbers. For instance: ...
12
votes
1answer
234 views

Longest common substring for multiple strings?

I'm looking for a way to get the longest common substring for multiple strings such as {home/dir1/dir2/jmoasd.txt,home/dir1/dir2/ivbnoxcihv.txt,home/dir1/dir2/siuhgiuchv.txt} should yield ...
3
votes
3answers
243 views

How to switch between a binary number as String and a as a list of digits?

I was trying with String Functions and I viewing any posts and have no results I want to know 1.- From cromo33 = Table[RandomInteger[], {i, 1, 33}] cromo33 ...
3
votes
3answers
107 views

Extract every nth character from a string

I'm trying to extract every 21st character from this text, s (given below), to create new strings of all 1st characters, 2nd characters, etc. I have already separated the long string into substrings ...
6
votes
3answers
309 views

How to convert a string into a structured list

I am trying to use an efficient notation for the timing of sounds that i can play in Mathematica. I would like to parse the string "{ab{c{de}}f}" as the list ...
2
votes
0answers
43 views

StringSplit acting weird on a String in StandardForm [closed]

To begin, this is my first post on stack exchange, so if my question is not up to par please let me know so I can make the appropriate edits. Now for my question: why is it that parsing a string in ...
2
votes
2answers
85 views

How to translate/convert UTF-16 code to its corresponding word/characters by Mathematica?

I'm using Mathematica10.0.2 on my Win7. Recently I crawled some websites by mathematica and within the information returned by URLFetch there are plenty of UTF-16M codes. These UTF-16M codes are ...
6
votes
1answer
88 views

How to make captions for a movie?

I'm trying to make my own video parody with custom subtitles. Creating your own custom subtitles file in a text editor with the SubRip or .SRT format is easy to do, it looks like this: Where 00:...
4
votes
1answer
80 views

Extracting integers from a string

Imagine I have a block of text that contains words and numbers. I want to extract all the integers from the text. Thus, if the input is ...