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
1answer
60 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
44 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
43 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
38 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
82 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
25 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,
0
votes
0answers
39 views

Find how many words are in the Wikipedia article for “computer”? [closed]

I am getting the answer "8879" but, the article is updated and hence answer doesn't matches the expected output "7742", what should I do.
2
votes
0answers
29 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
125 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
45 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
65 views

Manipulate mapping on lists

For some function f, consider the following expression: ...
6
votes
2answers
86 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
59 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
30 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
46 views

select partially matching filenames

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

Purpose of ToCharacterCode [closed]

Is ToCharacterCode function the same as assigning ASCII decimal to a character?
1
vote
1answer
21 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
40 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
50 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
140 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
59 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
116 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
148 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
64 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
64 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: ...
3
votes
1answer
65 views

How do I convert an expression to a string while keeping -> as one symbol?

When I write ToString[a->b], regardless of whether the input uses the right-arrow symbol or - and ...
7
votes
1answer
120 views

Is there a way to get tooltip for parts of a string?

Is there a way to get the tooltip to appear for parts of a string? ...
2
votes
1answer
51 views

Concatenate a variable with a string

I have a little problem with a variable and a string. I built a game with a panel that shows a random word,the player clicks "Yes" if he knows the meaning and clicks "No" otherwise....
7
votes
1answer
106 views

StringMatchQ fails using Alternatives with complex pattern

Alternatives seems to work fine with these simple patterns ...
1
vote
1answer
62 views

Compute the length of each string in a set [closed]

Say I have done some computation, and it gives me the following set of string: ...
1
vote
1answer
37 views

Convert string to executable code

This is what I have done to turn the string to executable code. ...
0
votes
3answers
68 views

Repeating strings and shifts of these

I am dealing with things coded as a binary strings. We can think of these as binary expansions of angles on the circle. Suppose I take something with a repeating binary expansion like $\frac{3}{7} = \...
-3
votes
1answer
63 views

Permutation Combinations Mobile Pattern Codes [closed]

Please help write codes to determine 4 to 6 dot patterns. I am stuck after permutations input. It would really help if one could write direct so I could copy paste code to determine list of 4 to 6 dot ...
0
votes
1answer
26 views

Problem with exporting text

I prepared in Mathematica some long text: text = string1 <> string2 <> ... <> stringn; (some strings contains TeX code). Then I would like to ...
2
votes
1answer
45 views

Counting the number of elements

I have the following output: {{{0, 1}}, {{1, 1}, {1, 2}}, {{2, 1}, {2, 3}}, {{3, 1}, {3, 2}, {3, 3}, {3, 4}}} Using Length[] on ...
2
votes
1answer
38 views

Why exported text ends with a highlighted percent symbol?

I have recently updated Mathematica to 12.1. Whenever I export strings as text now, as in the following MWE: ...
4
votes
2answers
225 views

What is wrong with function `LetterCounts` and other functions that operate on strings?

I have noticed that many functions that are meant to operate on string are slower compared to similar functions that operate on lists. One example: Counts versus <...
3
votes
1answer
72 views

Comparing two strings - code optimization

I want to compare two strings by counting how many common characters they have at the same position - but overall in all possible alignments of the two strings. ...
7
votes
0answers
62 views

Export Strings without quotes to a CSV file [duplicate]

Would like to export a List of Lists to a CSV file. Would like the strings in the exported file to not have quotes around them, which doesn't appear to be the default behavior. Is there an option ...
1
vote
2answers
81 views

Finding position of specific substring within string

Is there a simple way of finding the position of a specific instance of a substring within a string? For instance, in the sentence "Bob bought his car at the car dealership". Something like <...
8
votes
2answers
371 views

How to remove any words containing two adjacent characters with different in both cases and letters?

I have a list of permutations of ABCabc and I want to remove any permutations with two adjacent characters with different in both cases (uppercase and lowercase) ...
3
votes
2answers
190 views

How to check whether a string contains a certain number of consonants and vowels?

I am trying to check the answer of the following problem programmatically. A manual calculation by hand must be possible but it is not my question. Given a string ...
3
votes
3answers
396 views

Delete Characters from a list

I have a list which contains multiple words and unsupported characters as well : for eg: {é, â, ê, î, ô, û, c, re, be} I want to remove all of the above characters ...
7
votes
1answer
162 views

StringJoin in Thread not working

Here is what I have tried first. Thread[f["x", {"1", "2"}]] ...
5
votes
2answers
456 views

using regex to find a specific word

I want to find the word "circle" and "circles" in the list. list = {"circle" , "picircle" , "circles" } The regex ...
-1
votes
1answer
35 views

Accessing Elements in a nested list

I have nested list of the form: (which I don't want to flatten :) ) lol = {{"hello", "bye", "bye", "Hello"}} How do I ...
2
votes
3answers
86 views

Multiple Calculations in a condition

I want to add and subtract 3 from a list. pos = {82,84} If[# > 3, (# - 3) && (# + 3)] & /@ pos the output I want: ...
3
votes
2answers
256 views

Last part of a url (after the “/”)

I want the last number after the "/". How can I do that? "http://arxiv.org/abs/math/0208009v1" I just want 0208009v1 I want to import multiple ...
0
votes
1answer
37 views

Comparing elements in a list and ignoring white space

I have two lists with element entries. I want Mathematica to identify an element in an opposing list such as Ag107 to be the same as Ag 107 ignoring any space. Each different element occurs only a ...

1
2 3 4 5
22