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

learn more… | top users | synonyms (4)

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

StringSplit acting weird on a String in StandardForm [on hold]

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 ...
1
vote
1answer
51 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
54 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
0answers
53 views

rename files randomly

I need to read a directory with pdf files, rename them by numerical sequence of 8 digits when lifting with pdf extension, and then record the result (the idea is that they are totally random names ...
6
votes
1answer
84 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 ...
4
votes
1answer
76 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 ...
-1
votes
0answers
81 views

Problem with System.Array in Mathematica

i am using NETLink to use some COM Objects in Mathematica, it works fine with almost all the functions, except one, that function has the following sintax in VB: Compute_CurrentPlan(nmsg As Long, ...
0
votes
0answers
42 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 ...
5
votes
1answer
98 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
263 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
105 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
89 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, ...
10
votes
2answers
300 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
860 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
66 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 ...
5
votes
1answer
66 views

Can't access `AnyOrder` named parameters

Straight from AnyOrder documentation ...
3
votes
2answers
55 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
62 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
37 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
125 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
55 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
798 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
115 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
45 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 ...
13
votes
2answers
164 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
41 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 ...
4
votes
1answer
107 views

Trim a list of elements [closed]

I suppose this is a trivial question to many of you, please bear with me. I have a long list of words, list1. I would like to "remove all words that contain a specific letter, say "o". ...
1
vote
1answer
62 views

How to use StringReplace “from bottom to global”?

Suppose I have an original string that looks like: str1 = "erewrer<.rer>r33e<erer>re<><>rer\nrer<ew212>" I want to get rid of all ...
1
vote
1answer
77 views

How to get missing lines from a file? [closed]

Let's say I have this file dat.csv which basically is a number of strings like that: animal horse duck dog plant tree grass sunflower sky oxygen nytrogen air ...
3
votes
1answer
163 views

How do I use StringReplace to replace repeated characters?

Suppose I have str = "dededekmkmkmvkfjdedemkvmlvdedekfmmdedededemkmkde" And I want to replace the repeated "de"s to one and produce (in a real example, the ...
4
votes
1answer
38 views

help with string patterns and RemoveCellTags

I am building a table of contents using AuthorTools. I used it to create cell tags so the TOC can make hyperlinks, but then I decided I wanted to change them. But I am having trouble removing the ...
0
votes
1answer
73 views

How to convert this .txt data into a list of points [closed]

Question How to import data from a .txt file into Mathematica and convert it to an expression? Download the .txt file here (click download): http://pastebin.com/2NW2DfiE
2
votes
1answer
45 views

read Python-generated data file

I've read similar-but-not-quite-the-same questions : I have to read a python-generated data file which contains complex numbers. So, the numbers appear as (real+imag j). And of course Mathematica ...
4
votes
2answers
64 views

Abbreviated expressions in StringCases? [duplicate]

Am I missing something here? There's no support for abbreviated expressions in StringCases? StringMatchQ["MATCH", "*H"] (* ...
5
votes
1answer
76 views

What are “\<” and “\>” delimiters in box expressions?

If I enter a string (say, "abc") in a cell, and then switch to box representation (Shift+Ctrl+E or menu item ...
6
votes
2answers
239 views

How to I extract the element name of a chemical compound in a string?

Say I have a compound Fe3O4, and I want to separate the name of elements and number. The code I write for separate number is ...
0
votes
1answer
50 views

Oddity with ToExpression [duplicate]

Is this a bug? ToExpression["3231.432"] 3231.43 I would have expected the following: 3231.432 I am using Mathematica 10.2.0
3
votes
1answer
64 views

How to collect elements in one list with the constraints provided in a second list

I wish to collect the items in the first list provided the constraints in the second list. For example in the lists shown below the first list shows a bunch of strings and the second list shows the ...
2
votes
2answers
56 views

Remove an element of a list [duplicate]

I want to check if any element of a list contains Missing["NotAvailable"] If so I want to delete the entire list. If I am correct I need to have some ...
1
vote
2answers
86 views

Void elements / self closing tags export to HTML

There are some built in rules in exporting that automatically create Void elements / self closing tags for some tags: ...
6
votes
1answer
138 views

String replacement in a large text file

I have to replace a string, let's say "ABC" to "XYZ", in a huge plain text file (10 Gb and above). Obviously, the ...
3
votes
1answer
77 views

Wrapping long strings at word breaks

My code (PostScriptForm) returns a long string, about 7k characters, in which there are eight deliberate “\r\n” ‘paragraph’ breaks. Copying the long string into a ...
4
votes
3answers
173 views

Replacing doubled letter with that letter plus a code

I want to replace the second occurrence of a letter in a double letter pair with a specified code. For example, if the code is a capital letter "X", then the input ...
3
votes
1answer
85 views

How to use `Shortest` for pattern matching? [duplicate]

For the string ((!@#)), the shortest match for the pattern "("~~__~~")" should be "(!@#)", ...
8
votes
1answer
139 views

How to take all sub-strings in a string that are combinations of specified characters only

"tgtaaaaacaagaaaaacatggaatgtataatactataaataaaaaaagtaggaagaagaaccaaaaca\ aagggcgttttaaagagagacgaat" based on the above string (a DNA sequence) I wish to extract ...
3
votes
1answer
37 views

Entering null characters in a string

This question is about parsing files that contain nulls (character code zero) as field separators. Intending to attempt to answer this I began by trying to enter a string containing a null, e.g. by ...