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

learn more… | top users | synonyms (4)

2
votes
1answer
55 views
3
votes
1answer
31 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, ...
2
votes
3answers
72 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
54 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 ...
2
votes
2answers
78 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
25 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 ...
8
votes
2answers
208 views

Position and string patterns

I am trying to get Position work with patterns. I have the following code: ...
2
votes
1answer
60 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
185 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
30 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
39 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
61 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?
0
votes
1answer
67 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 ...
3
votes
2answers
110 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
127 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: ...
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 ...
6
votes
4answers
180 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 ...
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] ...
12
votes
1answer
219 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 ...
1
vote
0answers
73 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: ...
6
votes
3answers
307 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 ...
3
votes
3answers
103 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 ...
2
votes
2answers
78 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
87 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 ...
0
votes
0answers
45 views

Constant Strings?

I am writing a workbook to compute double integrals, and in order to graph the function in polar/cylindrical form, I have to make a substitution in the original formula. How can I have the original ...
6
votes
1answer
106 views

StringPattern to remove markers around text

I am not able to figure the StringPattern to use to remove markers in string. This is the input. ...
10
votes
4answers
281 views

Convert elements of list to string

how easily can I convert elements of this list to string. If I have output like this: {{M, 1, 0, 0, 1, 1, 1, 0}, {A, 0, 0, 0}} And I want something like this: <...
2
votes
1answer
107 views

Problem with deleting words from text [closed]

The task I need to do is to import a text book from here http://www.gutenberg.org/cache/epub/36/pg36.txt, then drop the last 20000 words from it and determine how many times the remaining words occur. ...
2
votes
3answers
122 views

Importing a VCF file with quoted-printable encoding

The documentation has an example importing a VCF address book file which works fine: Import[ "ExampleData/wolfram.vcf" ] {{FormattedName->Wolfram Research, ...
11
votes
2answers
304 views

How can one represent a string pattern with prohibited substrings?

Say I have the following string: "<hello>something WRONG</hello><hello>something else</hello>" I am trying to find code that works like the ...
4
votes
1answer
129 views

Insert a symbol include first and last position [closed]

Assume we have a list list = {"a", "b", "c", "d", "e", "f"} Then use this code: StringRiffle[list,"*"] But ...
5
votes
3answers
903 views

Analyzing frequency of individual letters in a large body of text

There are interesting histograms about the English language: BarChart[Counts[StringTake[WordList[], 1]], ChartLabels -> Automatic] ...
1
vote
3answers
67 views

Adding numbers to a list

Say you have the following list of 12 elements X={"x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x"} And I want to turn it into the following sorted ...
6
votes
1answer
69 views

Can't access `AnyOrder` named parameters

Straight from AnyOrder documentation ...
3
votes
2answers
56 views

How would I split a string into substrings ending with a delimiter and a maximum length?

I have a list of parameters, formatted as a string of integers and reals in both simple and scientific notation, with a comma as delimiter. A short sample: ...
0
votes
1answer
33 views

Extra character in StringJoin [duplicate]

When I was trying to join a URL with a parameter and execute it with URLFetch, something unexpected happened. Here is the code (The URL below doesn't exist and is ...
-1
votes
2answers
65 views

Matching timestamped data

I bet this question is a gimme for most of you guys, but I'm having a bit o' trouble figuring it out. Thanks ahead of time for your input and help. Soooo, I have two datasets where column 1 is a ...
3
votes
1answer
43 views

`ReadString` and `StreamPosition` behaving strangely with custom terminators

I've stumbled on a strange behavior while trying to use custom terminators for ReadString. When I use a simple String as the ...
4
votes
5answers
131 views

How to efficiently stream words and whitespace from a large text file

I want to tokenize a large (~20 MB) file, opening it and streaming the words, but preserving the whitespace as well. Example: ...
1
vote
0answers
68 views

Using \n (new line) as delimiter in StringSplit

While trying to build my own simple C-language highlighter for strings in Mathematica (see here for a very sophisticated highlighter generator package by Leonid Shifrin) I came upon the issue of using ...
1
vote
0answers
48 views

Creating an indexed set of functions with the indices in the function names [duplicate]

As the titles describes, I want to create a list of functions like the following, where the indices are not in the argument slots: ...
21
votes
3answers
805 views

Typoglycemia text manipulation

I was just reading the article: https://en.wikipedia.org/wiki/Typoglycemia "... readers can understand the meaning of words in a sentence even when the interior letters of each word are scrambled ..."...
12
votes
0answers
121 views

Can Mathematica convert a RegularExpression into a StringExpression or vice-versa?

I know that Mathematica can perform string comparison using either StringExpression or RegularExpression. Although regular ...
0
votes
1answer
49 views

Mapping StringToDouble over nested lists of strings, still confused about slots

This is a simple question about slots but I still cant see how to do it after searching stackexchange. (I'm importing a large data file as text and to convert to numbers I think it'll be quicker to ...
15
votes
2answers
193 views

Unexpected behaviour when pattern matching with Longest

I came across some unexpected behaviour today when using the Longest function when trying to do some pattern matching. ...
0
votes
1answer
44 views

Convert string to function with an argument

I am trying to build an expression by first writing it out as a string and then using ToExpression to convert it to an expression. However, I cannot figure out how to make expression recognize x as an ...