Questions tagged [string-manipulation]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
16 views

$P=QRS$ decomposition decomposition of given list

This is an extension of my previous post $P=QR$ decomposition of given list Now for this time, I want to decompose arbitrary list $P$ into three pieces for ordered or non-ordered cases. Based on the ...
1
vote
1answer
39 views

$P=QR$ decomposition of given list

For given arbitrary lists, I want to decompose the list into two parts and assign individual lists. i.e., I want to decompose, $P=QR$. And I can think of its decomposition in two cases: ordered and ...
0
votes
0answers
61 views

Creating new variable names, Symbol or ToExpression

One can create new variable names by Symbol : In[1] Table[Symbol["x"<>ToString[i]], {i,1,5}] Out[1] {x1,x2,x3,x4,x5} But it is also possible to ...
0
votes
1answer
41 views

How to Set Text Format by User-Defined Function with Input as String

I have simple but annoying problem here. I guess it occurs to many Mathematica users. The thing is that I wish to define a function to format the text in Mathematica. Yet, I don't know whether it is ...
0
votes
1answer
36 views

Converting HyperInt Hlog to Polylogtool G [closed]

how do I replace efficiently HyperInt's Hlog (in maple expression) {Hlog(Y,[1]),Hlog(X, [1, -Y + 1]),Hlog(X,[1,1,1])} in an expression into PolyLogTool G: {G[1,Y],G[1,-Y+1,X],G[1,1,1,X]} Basically, ...
0
votes
0answers
87 views

how to change list of some scalars into vectors?

I have a pair of equations f= {eq1,eq2} that are (x,y) dependent. I take derivative by (x) and (y) for each equation, for example, Grad[f, {x, y}] . {1, 1}] and ...
2
votes
1answer
59 views

ToString with delayed replacement [duplicate]

I want a toString method that replaces each occurrence of f[x_]. ...
6
votes
1answer
339 views

When should I use `<>` instead of `~~` to join two strings?

Both <>, i.e. StringJoin and ~~, i.e. ...
3
votes
3answers
216 views

Make matrixes with numbered name

Suppose I have two matrixes M1 = {{0, 0}, {0, 0}} M2 = {{0, 0}, {0, 0}} Now I wanna have $N$ matrixes in this form called M1, M2, M3, M4,...MN How to code to ...
4
votes
1answer
149 views

Copy clipboard content to mathematica notebook - line break symbol changes

There are 3 kinds of line breaks \r \n \r\n For windows, \r\n is standard. Suppose that there is a file called document.txt, using \r or \r\n as line breaks. Suppose that I open document.txt with a ...
1
vote
1answer
60 views

Palindrome by deleting a character

I need to find a list of strings with input string length n for whom are palindrome by deleting a character from it . The strings are stored inside function ...
2
votes
1answer
55 views

Find all substrings from a string by deleting characters from it

Problem Description : I need to create all substrings from a string by deleting letters from it without re-arranging the rest of the letters. For example, "us" is a substring of "...
0
votes
0answers
43 views

Split a String by minus and zero

How can a String like 0.0002230.0012730.000296-0.0014380.0011270.0014690.001457-0.001017` be converted to ...
1
vote
1answer
32 views

Insert string elements to an array

(Minimal example) I'm dealing with the following array : ...
3
votes
2answers
168 views

Recursion in String Length of Roman Numeral

I am new to Wolfram language (Mathematica) programming, I have below problems. To summarise the problem : The input is a positive integer, and the output is a recursive list of the lengths of the ...
0
votes
2answers
45 views

How to make the third parameter optional and adding some condition?

I have a function as follows. The function has 3 parameters. Now I would like to make the third parameter i optional. So you call call it like ...
3
votes
3answers
70 views

Parse string to association

Here is a string, which I call data: ...
1
vote
1answer
45 views

Highlight text given String and String-Pattern

given a String: string = "the cat is on the mat" and given a String-Pattern ...
2
votes
1answer
78 views

How to convert Strings from Mathematica (UTF-8) to Linux with locale “de_DE.UTF-8”?

I want to do file system operations with a Mathematica program. I see, that Mathematica and my Linux operating system use different encodings. According to the unix command ...
19
votes
1answer
650 views

Is Internal`StringToDouble broken in 12.3?

I believe Internal`StringToDouble was the only way to fast convert string into numbers. Now in V12.3 it was removed: Internal`StringToDouble["1"] ...
1
vote
0answers
11 views

PaddedForm - DigitBlock only respected for non-padding

I'm trying to pad some binary and hexadecimal numbers using PaddedForm, and also to separate the digits into blocks of 4. For example, I'd like a number like ...
1
vote
1answer
58 views

how to delete the nth line in a multiline string?

How do I delete the $n$th line in a multi-line string. For example how would I delete the $2$nd line in the following string? ...
0
votes
3answers
32 views

Divide string only at line breaks [closed]

I have a very simple problem but don'tk now how to solve it. I have a string that looks like this: string="a b c d e f" I want to break it ONLY at the line breaks, i.e. I want to get a list ...
3
votes
1answer
38 views

How to return NumberString's after a certain word

I'm interested in the general operation of extracting NumberString's after a certain keyword. Here is a specific example Consider the string: ...
2
votes
1answer
66 views

String manipulation problem

I have many strings of the following kind: ...
0
votes
1answer
68 views

How to convert decimals to integers and joint them to a string for exporting

There's a list such as {0.1,2,0.15,5}. I want to know how to convert the decimal to integer( but begin with zero 0), and don't ...
1
vote
1answer
49 views

How to make StringCases to understand the scientific form of numbers?

Consider the string string="Tau_distribution_mass=547.0_theta=6.87982e-05.txt"; I would like to make a row ...
1
vote
1answer
49 views

Check if two cells are identifcal

Is it possible to check whether two cells in a Mathematica notebook have exactly the same code? I'm comparing two bits of code that might be the same, but rather than eye-checking, I wonder if there ...
1
vote
1answer
41 views

How to extract the data from the given filename?

Consider a few files with filename structure data/Neutrino distribution functions/NAME_distribution_mass=XX.0_theta=0.YY.txt where XX/YY may have an arbitrary ...
1
vote
1answer
86 views

interact with web pages with many hyperlinks and search for a specific name or phrase How?

I have this code that shows many hyperlinks links = Import[ "http://www.liceobrainstorm.cl/wp-content/uploads/2020/07/", "Hyperlinks"] ...
0
votes
0answers
27 views

Make a bar chart of the lengths of the words in“A long time ago,in a galaxy far,far away"

The expected output and the output obtained both are same, but why is it showing it wrong. All the desired functions have been used,
2
votes
0answers
30 views

recursively find StringCases

Can I recursively extract StringCases[] that match a specific pattern? Here is a minimalist example (not my actual problem): input ...
10
votes
2answers
133 views

Find all English words that can be comprised of Element Abbreviations found in the Periodic Table

This question is majorely influenced by a meme... Now, I thought... it would be interesting to see what kind of "passwords" could one derive using Periodic Table :D Hence, I began to work ...
0
votes
2answers
46 views

How can I transform the string to a list?

As you can see from the picture, when I use StringReplace function, the list is converted to a string. How can I get the list form back? And the String "-" is necessary (Cuz I just know one ...
1
vote
1answer
67 views

Manipulate mapping on lists

For some function f, consider the following expression: ...
6
votes
2answers
92 views

StringCases and Shortest from right to left

As explained in https://mathematica.stackexchange.com/a/72293/45020, using Shortest in StringCases does not actually return the ...
2
votes
2answers
83 views

Finding Mnemonics for expressions with lots of indices

One of the equations I work with in my research are the pentagon equations: ...
1
vote
0answers
31 views

What is wrong with SimilarityRules in SequenceAlignment for lists

I try to align two lists by SequenceAlignment. This works properly for default SimilarityRules ...
0
votes
1answer
47 views

select partially matching filenames

I have two lists of files with slightly different naming conventions ...
0
votes
1answer
50 views

Purpose of ToCharacterCode [closed]

Is ToCharacterCode function the same as assigning ASCII decimal to a character?
1
vote
1answer
22 views

Replace number in a part of a string based on a numeric condition and manipulate numerically cases with neighbours

I want to replace numbers in a string based on a numeric condition. Let us suppose the following string "xxxx250 123|1,4|0,5|1,17|0,55|1,111|0" I want to replace those numbers that are part ...
0
votes
1answer
42 views
2
votes
0answers
41 views

Phonetic Levenshtein Distance

I'm working on some code to try to sort the "Fry" sight words (found here) into 2 lists sorted by similarity to help my daughter learn to read. I've found that when presented with multiple ...
3
votes
2answers
60 views

How to merge two lists of strings (date and time) and treat them as DateObject

I would like to merge two lists of strings (date and time) from my csv and then treat it as a DateObject: ...
4
votes
3answers
143 views

How to convert a real number to a string only in the original length?

Example: I have this number num = 2.9525730420542016*10^1798 (* 2.952573042054202*10^1798 *) If I want to convert it to a string, I don't get "2....
0
votes
2answers
71 views

Convert GiNaC harmonic polylogarithms to HPL packages' notation in Mathematica

A general output from GiNaC (https://www.ginac.de/) of harmonic polylogarithms is H(a,b,c...,x). We want to convert it to Mathematica format (https://www.physik....
3
votes
1answer
127 views

Find words in a messed up table [duplicate]

This table with a caption that said "First three words you see will come to you in 2021" inspired me to do some digging: Imagine that we have a table with randomly filled letters. How can ...
3
votes
2answers
150 views

Trying to generate a string of text

I'm trying to use mathematica to generate some code that I can use in excel. The goal is to have something like: IF(BB32="",CA31,0)+IF(BB34="",CA33,0)+IF(BB36="",CA35,0)+...
1
vote
0answers
65 views

A glitch with importing a list of lists of polynomials [closed]

Would anybody know how to import a list of lists of polynomials which I exported earlier? ...
1
vote
0answers
67 views

Alternatives not working with Sequence[]?

In the following piece of code I've specified two possibilities to match via Alternatives, but only one of them seems to be considered: ...

1
2 3 4 5
22