Questions tagged [string-manipulation]

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

54 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
12
votes
0answers
103 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 ...
9
votes
0answers
97 views

Probable bug in Export(String) and “String” format

Bug introduced in 6.0 and persisting through 11.0.0 or later ...
7
votes
0answers
124 views

How to `URLEncode` spaces properly?

URLEncode encodes spaces as plus symbols, but this isn't what we want: The encoding used by default is based on a very early version of the general URI percent-...
6
votes
0answers
66 views

Repeated string pattern: difference between the FrontEnd and WolframScript?

This code works fine in a string based interface like WolframScript or Mathematica Kernel. Run this through a string based interface ...
6
votes
0answers
91 views

StringTemplate performance issue

StringTemplate introduced in version 10 is very convenient in constructing formatted data. However, it seems to have a huge performance issue. Consider this ...
5
votes
0answers
43 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: <...
5
votes
0answers
80 views

SimilarityRules for SequenceAlignment of two lists

I am trying to use the SimilarityRules option of SequenceAlignment to customize its output. This works perfectly for strings, ...
4
votes
0answers
37 views

Multi word synonyms

I’m looking to write a semantic distance function for phrases (4 words or less) that can map multi-word synonyms together. Here are some examples: “Red shoes” would be close to “Orange sandals” “Blue ...
4
votes
0answers
97 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? ...
4
votes
0answers
112 views

Error with String patterns producing Removed[“$$Failure”]

While working on How to capitalize the first letter of each word in a string and trying to understand why certain characters were not considered letters I tried this: ...
3
votes
0answers
71 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 ...
3
votes
0answers
58 views

Why was StringRepeat designed so that StringRepeat[s, 0] throws an error?

I'm wondering about the rationale behind the design decision that leads to the following expression throwing an error: ...
3
votes
0answers
97 views

Copy string with markup so it looks good on input

How can I copy a string with a bunch of *Box expressions without it blowing up into the raw expression? ...
3
votes
1answer
79 views

How can I lookup the grammatical type of a word?

It seems WordData isn't complete: ...
2
votes
0answers
42 views

Confusing behavior for GrammarRules and GrammarApply

I have been experimenting with GrammarRules in an attempt to create a parser for text downloaded from the web. I have been using Interpreter to help understand the behavior of GrammarApply. Here is a ...
2
votes
0answers
40 views

Modifying the first integer occurence in a string

I have a problem with a list of strings where I want to change the first integer occurence in each entry. The lines all look like this: ...
2
votes
0answers
258 views

How to decode Ascii85 format (AKA base85)?

The ASCII85 encoding is a binary string encoding where every four bytes are encoded with five ASCII letters, using 85 different types of characters. Unfortunately, it's not in $CharacterEncodings: ...
2
votes
0answers
85 views

How to implement a regular grammar in Mathematica 10.0 onwards?

I would like to see a new answer to this question: How to implement a regular grammar? considering the introduction of GrammarRules in 10.0 ( 2014 ). ( I don't know if this question satisfies the ...
2
votes
0answers
140 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: ...
2
votes
0answers
123 views

How to efficiently find parts of a string with beginning and ending specified?

I'm trying to find specific URL addresses from a html document. The addresses can be found between the strings "href=\"" and "\" class=\"listing". The problem is not including strings like this: "href=...
2
votes
0answers
373 views

Read in Bézier curve from SVG file

I am trying to do some calculation of some SVG file. After reading in with Import["filename", "XML"] and some easy operation, I can get the string of the Bézier ...
1
vote
0answers
49 views

How can I handle box drawing characters?

I must generate files for windows batch scripting, modifying template files, es. ...
1
vote
1answer
54 views

Function returning a pattern with condition - how to prevent condition to evaluate prematurely?

I figured it would be convenient to have a function that returns a pattern, that match equally nested brackets, of the specified type. Such a pattern is easy to create, but I get some error messages, ...
1
vote
0answers
30 views

Remove expression with matched braces from string

I am writing a LaTeX document where the custom command \chg{...} highlights changes in some color. Here I am, with a document of about 50 of those. Sure, one could ...
1
vote
0answers
63 views

How to write a power using `WriteString` function

I have a solution of an equation: aa = N[Rationalize[g6[[3, 2]], 0], 16] (* Out: 2.691607147352649*10^-6 *) I want to save this result in a file using ...
1
vote
0answers
53 views

Reconstructing a partition from its character

Given a solid partition $\rho=\{\pi_1, \pi_2, ..\}$, where $\pi_a$ are plane partitions such that $\pi_{a+1} \subset \pi_a$, we can compute its character, which is a sum of monomials with non-negative ...
1
vote
0answers
43 views

Coverting a list of products to a list of strings

I am trying to find a way of converting a product of variables to a string, eg. if I have abc... I wish to obtain "abc...". I ...
1
vote
0answers
17 views

Removing HyperlinkedDefinitionSymbol's in a generated cell?

Is there a way to print out the definitions of a symbol with GeneralUtilities`PrintDefinitionsLocal without any hyperlinks (just the plain text of it in the code cell)? ...
1
vote
0answers
62 views

Enclosing text of Row in quotes

For a particular purpose I need to achieve the following: Can we convert Row[R = 2.5, Rd = 1.2, Subscript[\[Theta], w] = 1.8] into ...
1
vote
0answers
368 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 ...
1
vote
0answers
137 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 ...
1
vote
0answers
105 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: ...
1
vote
0answers
51 views

Where can I find documentation on use of special characters in templates?

I am new to Templates. I have seen the usage "\!\(\*StyleBox ...)" as here: disabling templates What does the string "!(*" accomplish and can I find some ...
1
vote
0answers
99 views

Geodesy without units?

Suppose I'm interested in the latitude of Los Angeles and I do the following: ...
0
votes
0answers
25 views

One input cell is giving two output cell

I have an input cell, and I have some code there whenever I run this cell I am getting two out out cell as a results, I need it to be like a single output cell how to do this? ...
0
votes
0answers
33 views

relating Compress[] to information theory

I have a question regarding the Compress[] function. From my reading, Compress[] is based on zlib and should provide lossless compression. Given a string (call it test), I would expect that, from ...
0
votes
0answers
83 views

Strip of all tags “Defer[…]” from a string expression

How can i remove all "Defer[...]" from the following expression ...
0
votes
0answers
40 views

Text with dynamic values

...
0
votes
2answers
78 views

Comparing strings within a list of strings

I have a single list containing strings like this: list={"house", "cat", "dog" ,"horse", "horses", "tree"}; How can I compare these strings within a list and ...
0
votes
1answer
57 views

Suppressing DateString default behavior when parts of date are missing

By subsampling data from a Excel spreadsheet I have created a Mathematica dataset that I then seek to modify by applying various functions to the fields to convert these data into a different flat ...
0
votes
0answers
44 views

Ignoring text when converting strings of text to numbers

I have a string of measurements--mostly numbers, but occasionally an NA. Right now Mathematica is reading it all as text, so I'm using ...
0
votes
0answers
46 views

How should I import list of results with scientific numbers so they can be used for further calculation?

I have a file, listOfResults.txt, consisting of many rows of which the following is an example: ...
0
votes
0answers
73 views

How to rasterize huge fonts

If ...
0
votes
0answers
55 views

Why does StringReplace wrap StringExpression around result?

The task is to separate a leading separator from subsequent text into a list. Why does StringReplace wrap StringExpression ...
0
votes
0answers
36 views

Reading rows from a string one by one

I imported my data(table format) and converted it into string using ReadString["file"]. Here is what I got: Now I want to read each row of my string one by one so that I can use them in solving ...
0
votes
0answers
99 views

Text-analysis: Import CSV without stringquotes

I have a large amount of text-files. I want to compare these text-files based on common 'words'. I export the output of my analysis as a CSV file. When I import the same file I get all seperate words ...
0
votes
0answers
53 views

Generate a system of linear differential equations from a coefficient matrix

I want to generate a system of linear equations that is stable. For that I generated random coefficients and divided the 10 by 10 matrix by the largest eigenvalue and set the diagonal to -1: ...
0
votes
0answers
43 views

Exporting a large number of image variables in mathematical 11

I used the following code to import a large number of tiff images into notebook. ...
0
votes
0answers
153 views

StringForm print fractions readable by ToExpression

I have a function f[x] that takes one argument. Sometimes, the evaluation of f fails and then I would like to print the function ...
0
votes
0answers
44 views

strse error in string operation

When I using jSoupLink, I found strange behaviour First, I load jSoupLink and define linkList ...