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

learn more… | top users | synonyms (2)

1
vote
1answer
13 views

StringCases: return list of outputs for each of several patterns

According to the documentation, StringCases[{s1, s2, ...}, p] returns {StringCases[s1, p], StringCases[s2, p], ...} but, ...
10
votes
2answers
139 views

ToExpression fails with long nested string expressions

Consider the following conversion from String to Mathematica Expression: ...
5
votes
3answers
217 views

String templating

I am pretty new to string processing in Mathematica. But I'm having some problems in doing simple string template filling to my mind elegantly. For example when doing export for my answer here, one of ...
2
votes
2answers
54 views

Using Table with arbitrary number of variables [closed]

Let $P=\{p_1,...p_n\}$. I would like a way to implent Table[Expression,{$p_1$,lim},{$p_2$,lim},...,{$p_n$,lim}] where n and lim are parameters defined by the user. Any ideas?
0
votes
0answers
38 views

importing a file with asterisk in its name (Linux machines)

I am trying to import a file: ...
3
votes
1answer
62 views

Convert an expression's symbols of form a$x to a[x]

I want a function that takes expressions of the following form: a$x and converts them to a[x]. In particular, consider the ...
6
votes
3answers
236 views

How to parse information contained in a file name

I have a set of files containing my data, and the file-names contain relevant information that I would like to extract. What I have is: ...
2
votes
3answers
401 views

Convert a string into a list of numbers

I got the following problem I don't know how to solve or if it's at all possible to solve(I'm quite new to Mathematica and don't have an IT background, so please explain slowly if possible:)) I'm ...
0
votes
1answer
72 views

Converting strings of the form “1.34e5” to real numbers? [duplicate]

ToExpresssion doesn't understand real numbers of the form "1.34e5". How do I convert the string ...
2
votes
2answers
93 views

how to take some parts of String with certain pattern

I have the large number of files in which the file's names follow certain pattern. for example here are names of two files ...
2
votes
2answers
77 views

Find names similar to a given name in a large data set

I'm trying to find a 'similar' name to every item in a list ...
2
votes
2answers
85 views

Importing Data and Devoting Their Names to Them

There are some files in a directory. I have used of SetDiroctory to access all of them. SetDirectory["C:\\Users\\SE7EN\\Desktop\\mathematica\\test"]; I can visit ...
8
votes
1answer
99 views

CSS Selectors for Symbolic XML

Symbolic XML is a convenient way of managing XML in Mathematica, at least for casual use or small tasks. Here and elsewhere you can find examples of XML handling in Mathematica, including XSLT/XPath ...
1
vote
2answers
43 views

Alternative to Except in StringExpression when using StringMatchQ

According to this answer and the documentation for StringExpression, Except can only be used in StringExpression for classes of ...
0
votes
0answers
18 views

How would I take a variable from a string and reassign its value? [duplicate]

If I have string={a,b,c}, where a=1, b=2, and c=3, how would I reassign a value to variable "a" without directly typing a = _? If I type string[[1]], the out put is "1". How would I generate the ...
0
votes
1answer
43 views

ToExpression and Fortran notation

ToExpression["9.0E-03"] interprets String as 9*e - 3 instead of what I am expecting ...
3
votes
2answers
99 views

Converting unevaluated lists to strings

I have a list like l = {2 - 3, 12 - 4, Times, aab} I want to end up with {"2-3", "12-4", "Times", "aab"} I have tried ...
4
votes
1answer
134 views

Selectively converting numerical strings to expressions

I have a list of strings representing different types of data ...
2
votes
3answers
221 views

Treat strings as variables?

I have a list of strings, {"x1", "x2", "x3", "x4"} And a list of linear equations: ...
0
votes
0answers
30 views

StringCount in Mathematica

StringCount["one letters three letters letters one letters letters three letters", "one" ~~ __ ~~ "three"] gives 1 because ...
2
votes
1answer
47 views

StringExpression: pattern reapeted one or more times matches pattern repeated zero times

I try to construct patterns using Riffle and Except StringExpression@Riffle[{"a", "b", "c"}, Except[{"=", ","}] ..] and expect it to match "a_b_c", but not ...
3
votes
1answer
84 views

Converting string representation of boxes into explicit boxes

It is very easy and convenient to write textual labels as Strings in the WYSIWYG mode. For example, I define a short form describing a linear model: ...
10
votes
1answer
200 views

StringReplace, ReplaceAll and Rule interact in a bizarre way

I have the following pair of things: ClearAll[foo, labeledFoo]; labeledFoo = {"FooBarBazQuux", foo}; This works like you'd expect: ...
2
votes
1answer
73 views

Generating the set of all strings within a fixed edit distance of a initial string?

Provided a starting string initialString, and a particular alphabet of allowed characters {"A","B","C","D","E",...}, how can I ...
3
votes
2answers
83 views

Finding all instances of length $N$ common subwords in two strings

Given a pair of strings, I'd like to return a list of all common subwords of a fixed length of "n" characters (i.e. contiguous subwords of length "n" that occur in both strings), allowing for ...
4
votes
1answer
75 views

What string pattern will match $n$ contiguous characters drawn from a given alphabet?

I'd like to use StringCount to count the number of subwords in a string that have the form **** where ...
0
votes
0answers
60 views

Read in bezier curve from svg file

I am trying to do some calculation of some svg file,After read in with Import["filename","XML"]and some easy operation, I can get the string of the bezier curve, ...
4
votes
2answers
113 views

Counting the number of instances of one sub-string within a given string within a lower- and upper-bound gap of a second sub-string

Please consider the situation where I give you a list where entries are drawn from a fixed set of characters: ...
3
votes
1answer
88 views

How can I get precise frame rates in dynamic?

I've been the Spritz sdk in my ios apps, and I love it. For funsies I wanted to see how much less code a mathematica version would take! Using dynamic I get a nice result, shown below in code. ...
23
votes
9answers
4k views

Programming paradigm change

I'm new to Mathematica, I've been learning by myself, and, being a Java developer for some time, it makes it hard to adapt. I've tried to solve a Reddit challenge, and I came up with this solution: ...
2
votes
1answer
52 views

Reversibly abstracting a list of strings as a graph object where vertices represent strings and edge connect pairs of strings based on various tests

Imagine I provide you a list of arbitrary strings, say: Map[StringJoin, Tuples[{"0", "1", "2"}, 4]]. I'd like to abstract these strings as a graph object in ...
2
votes
3answers
101 views

String formatting

I have the following string: "174,861.00 ( 4,053.52) 206,850.48 118.29 ( 31,989.48)" Parentheses stand for negative numbers. I will like to get ...
1
vote
1answer
91 views

How do I use wildcard characters with StringTake?

Say I'd like to pick substrings from some string such that these substrings have the pattern @@@q@@@, where @ is used here as a ...
1
vote
2answers
87 views
2
votes
1answer
84 views

Importing a Base64 encoded string

everyone, I'm handling some paragraphs enconded with Base64 from CSV file format. The problem is that Mathematica can't decode it. It seems Mathematica Encode/Decode their own Base64. I'm thinking ...
2
votes
2answers
106 views

Highlighting or coloring certain words / substrings appearing in a larger string

I have one longer string, longString, and a set $S$ of shorter strings {ss1,ss2,ss3,...}. I'd like to print out ...
1
vote
2answers
133 views

Deleting all characters in a string that do not belong to a small set of elements

Say I have a string {100 aa bbc%j%b%wa ajjcj11j0%2wj fc} with a lot of undesired characters or spaces in it, for example: {" ", "%", "w", "j"}. I'd like to strip the string of these characters, with ...
1
vote
1answer
54 views

using deletecases for twittermessages using the timestamp

I have a Excelsheet with tweetsmessages. These tweets are all written in Dutch. I would like to analyse these tweets in relation to the timestamp. ...
0
votes
2answers
64 views

Convert epoch seconds to date [duplicate]

I have got the following datetime from an API: 1395401384298 I am guessing it is in epoch miliseconds time (it should be one day in 2014) How can i convert it into a more readable String? I have been ...
5
votes
5answers
296 views

Joining some strings in a list of strings

So, say I have a list of strings, representing lines in a file, like so: ...
4
votes
1answer
111 views

How to differentiate between formatted and unformatted strings?

StringQ returns True both for unformatted and internally formatted strings. To get True only for unformatted ones I have thought up the following function stringQ. Please, can you point out ...
0
votes
2answers
60 views

ToExpression an array

I have a .dat file. I would like to convert a big array of strings(that's what I havein the .dat file) into an array of numbers, for example ...
1
vote
2answers
54 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 ...
0
votes
1answer
44 views

Replacing whole strings

I imported a text and seperated al words by using StringCases. After this I would like to manipulate the text, for example to replace all singular verbs to plural. ...
11
votes
5answers
1k views

What is the fastest way to extract a substring from a huge string?

I develop an algorithm to find the most common substrings of a given length n up to a certain distance l in front of a pattern p in a huge sequence S. E.g. I want to find the most common hexamers ...
2
votes
1answer
56 views

How to put Labels in of a list of number in a chart?

I canĀ“t put the labels 0,....,31 in this simple chart on the usual place, or better just over the Top of each bar How should I do? ...
5
votes
2answers
133 views

Using StringCases and treating certain phrases as single words

My question is about StringCases. When I use this function, each word is separated by a ,. But I want some noun phrases like ...
3
votes
3answers
131 views

Removing non-word characters from a string

I'm trying to get a list of words from a string. Sounds like an easy task for Mathematica. I have the following code: ...
0
votes
1answer
92 views

Importing data to make a DateListPlot

I am having a hard time trying to import some text data for later use in DateListPlot. My first field in my data is a date of the format "yyyymmdd". I tried to ...
3
votes
1answer
241 views

Paste letter grades B+ , C-, A, B into notebook and not get B+C-AB

I have worked for two days to find a way through this problem. I am porting my student grade records into Mathematica from spreadsheets, or sometimes from my college web sites, or sometimes from my ...