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
-1 votes
0 answers
96 views

How to stop a Syntax Message with Off or Quiet?

A little background to help you help me: this Dataset will store filename standards for the 3 major operating systems (NIX, OSX, Windows) for a filename validator I'...
user avatar
  • 1,837
12 votes
2 answers
473 views

How to convert Unicode to Chinese

I want "\u5b66\u6821\u73b0\u6709\u5728\u6821\u5b66\u751f25000\u4f59\u4eba\u\ ff0c\u73b0\u5f00\u8bbe30\u4e2a\u672c\u79d1\u4e13\u4e1a" to ...
user avatar
2 votes
3 answers
102 views

Divide string into a sublist of sentence with the maximum number of character

Context: I have a long article (on Wordpress). And I'm using Google Translate API (v2) to translate this article. This article has about 300 000 characters. However, due to the limit of Google ...
user avatar
  • 1,641
1 vote
1 answer
55 views

Why does my simple string function fail to grab the only element in a List?

The idea is to normalize a string before processing it to extract information from it. Strings may come with embedded outer brackets which are easily stripped or as elements of a true list. This is ...
user avatar
  • 1,837
2 votes
2 answers
80 views

Delete everything but alphnumeric characters and spaces

This should have been asked here, but apparently it hasn't. How to delete everything from a string except alphanumeric characters and spaces? For example, ...
user avatar
  • 435
3 votes
2 answers
151 views

StringReplace question from "An Elementary Introduction to the Wolfram Language"

I'm unable to come up with a solution to the following question in the "Introduction" online book, Chapter 42: "42.6 Make any 2-letter word uppercase in the first sentence from the ...
user avatar
2 votes
3 answers
96 views

Creating a list from the word cloud

So, the WorldCloud function applied to a string generates a word cloud graphic in which each word is sized according to its multiplicity in the string. Is there a ...
user avatar
6 votes
4 answers
566 views

Finding words that start and end with same letter

Why does this code run too slow? ...
user avatar
3 votes
1 answer
133 views

A bug in copy&paste of plain text

My mathematica version is 12.2 and OS is windows 10. In a new .nb document Write a string "abc" in the first cell Right mouse click on the first cell bracket click copy as - plain text ctrl+...
user avatar
  • 2,877
4 votes
1 answer
126 views

How to get a function from a string?

I'm trying to create a function that takes in input a function written as string and the return it applying a ToExpression and an Evaluate (Code below). The goal of this function is to transform the ...
user avatar
  • 69
6 votes
2 answers
237 views

File Path name copy&paste- single/double backslash problem

Shift+RightClick a file on windows explorer and select 'copy as path', then ctrl+v paste to mathematica notebook, then apply FileExistsQ : ex1) ...
user avatar
  • 2,877
1 vote
2 answers
110 views

How to convert E^x to Exp[x]?

I have a string for example "(E^Sqrt[x]*Sin[1 + Sqrt[x]])/Sqrt[x]", I want to convert E^Sqrt[x] to ...
user avatar
2 votes
2 answers
144 views

Double quotes as a 'function' (verbatim ToString?)

Can we construct a function F such that F makes any typed text into a string. Just like double quotes. ...
user avatar
  • 2,877
1 vote
1 answer
53 views

Plot issue : bad label ordering with concatenation of strings

I have an issue about a label which is consisted of a variable name [Omega]BD and a numerical value associated. Firstly, I put the BD subscript to ...
user avatar
12 votes
5 answers
786 views

How can I generate a list of combinations of string joins?

Suppose I have the string lists {'a','b','c'} and {'1','2','3'}. How do I get Mathematica to generate the list ...
user avatar
  • 1,857
8 votes
3 answers
488 views

Replace 'n'-th occurence with number 'n'

How can I replace n-th occurence with number n for string/for list? For string : ...
user avatar
  • 2,877
2 votes
1 answer
67 views

creating pairs of a {2,80} dimesion

Suppose that: ...
user avatar
4 votes
2 answers
144 views

Adding values to a string

So I have the following string: ...
user avatar
0 votes
1 answer
52 views

import a data file

I have 350 data files which i have exported like ...
user avatar
0 votes
1 answer
44 views

How to define a mixed pattern consisting of string and regular patterns for function definition (using SetDelayed)?

I'm kinda stuck here, and I could really use some help: I want to define a function, let's call it quarterValue, that accepts a ...
user avatar
  • 122
1 vote
0 answers
62 views

When should I add "~~" before the end of StringCases [closed]

I see these two lines of codes in my book, in which I find sometimes the ~~ was added to the end of the StringCases and sometimes not. For example: ...
user avatar
  • 173
3 votes
2 answers
166 views

Construct table from list of strings

I have data in this form: ...
user avatar
  • 327
1 vote
0 answers
40 views

Finding a root word

w = "successfully"; {DictionaryWordQ[#], WordDefinition[#], PartOfSpeech[#], WordData[#]} &@w ...
user avatar
  • 16.2k
1 vote
1 answer
98 views

Solving Wordle like puzzles using dictionary lookup

I will share a simple non-automated code fragment on how to solve Wordle like puzzles using Mathematica by playing against an automated web opponent. Any other insights to improve the algorithm will ...
user avatar
  • 16.2k
2 votes
1 answer
52 views

How to find the position of the closest part to a certain sentence in a large paragraph?

I have a large paragraph, the part of which is near to(not always equivalent to) one given sentence. Now I want to find the position of this part. For example, my paragraph is below (for convenience, ...
user avatar
  • 188
2 votes
1 answer
74 views

Select data based on string pattern

I'm trying to select data from nested lists based on seconds. This is my data: ...
user avatar
  • 327
0 votes
0 answers
38 views

Concatenate string with the value of each element of a vector/list

I have a vector/list t = {4, 5, 6}. I want to output each element (its value) of t in a string of characters. For example, the ...
user avatar
  • 443
4 votes
3 answers
143 views

Extracting a string located before a keyword

I am new to Wolfram and i would like to extract a few words from a website based on locating a key string. Specifically, i am trying to access the website: https://www.sec.gov/Archives/edgar/data/2178/...
user avatar
  • 51
3 votes
3 answers
157 views

Finding the index of certain strings in a list

I'm actually using a dataset of much greater dimensions and length but I simplified my problem of string patterns in order to ask this question. ...
user avatar
  • 1,024
1 vote
2 answers
77 views

How to search a directory of nb files for a string?

I would like to find a particular string in a set of nb files in a directory but am having problems interpreting the results of my code. Here's a simple example: In directory d:\mathematica, I have ...
user avatar
  • 1,114
3 votes
2 answers
136 views

How to substitute the variables in StringForm to an expression/function

I have some variables derived in StringForm. For example; variables = StringForm["x=``,\[Delta]=``", 5, 10] How to ...
user avatar
  • 453
1 vote
1 answer
35 views

How to change the format of ReadList

I have a quick question, please help me if you have an idea: 1- i need to read the data in another format, in the desired answer the records must be separated by &&, and without braces { } . ...
user avatar
  • 443
1 vote
2 answers
55 views

combine those $n$ lists without specifying whole $n$ sets explicitly?

Suppose I have $n$ lists, How to combine those $n$ lists without specifying whole $n$ sets? I mean; For a given lists list1={{3, 1, 1}, {1, 3, 1}, {1, 1, 3}} list2={{2, 2, 1}, {2, 1, 2}, {1, 2, 2}} ...
user avatar
  • 335
2 votes
1 answer
60 views

Join variable with string in a label plot

I have a simple problem regarding writing in a plot label variable and numbers. I have checked in other forums, but I was not able to solve my problem. I have this plot ...
user avatar
  • 403
2 votes
0 answers
57 views

Store pattern names in variables, and use them in Condition (/;)

I am trying to create patterns whose form is not hard-coded, and which are not explicitly directly written. For that I want to use one list of pattern names to name some parts of a ...
user avatar
  • 483
1 vote
1 answer
64 views

how to create a list of strings using two other lists

Given two lists lst1 and lst2: ...
user avatar
  • 4,391
1 vote
4 answers
72 views

Link elements from list to make more lists from certain lenght [closed]

How can I go from this list [36, 73, 84, 0, 73, 83, 0, 69, 69, 78, 0, 84, 69, 75, 83, 84, 31] to this [0000003673, 8400738300, 6969780084, 6975838431]. Is there also a way to make the elements the ...
user avatar
  • 27
0 votes
2 answers
82 views

How to remove quotation marks in Table List

I have Import a .txt Data = Import["files.txt", "Table"]; But the Data ...
user avatar
  • 445
3 votes
2 answers
122 views

Remove words from a string that contain special characters

I have a string like this: string="there is a humble-bee in Hanna's garden"; Now I want to exclude those words that contain "-" and "'"...
user avatar
  • 669
1 vote
3 answers
59 views

Extract a row from dataset based on two strings

Say I have a list as below: ...
user avatar
  • 171
1 vote
0 answers
28 views

How to draw a line marking where each chapter occurs in a text? [duplicate]

I am performing a text analysis on C.S. Lewis's book The Lion, the Witch, and the Wardrobe. I have created the following analysis of textual occurences of Aslan or Lion, Peter, Lucy, Edmund, Susan, ...
user avatar
1 vote
1 answer
237 views

How to Create an Efficient Word Square Algorithm?

I am working on the Wolfram Challenge Babbage Squares. I have looked at the following resources in order to come up with an idea for how to find all the possible word squares: Word Squares and Beyond ...
user avatar
0 votes
0 answers
72 views

How to Shape Text?

Imagine I have a certain number 23819657294172004194219023914217958273128471531429470113 If I convert it to a string with ...
user avatar
  • 4,246
3 votes
2 answers
306 views

How to extract email addresses from a text file using Mathematica

I have a text file which I have uploaded here. I want to find all email addresses in this text file. I just know that some of them are after "Subscription Date" expression (I don't know if ...
user avatar
  • 1,047
0 votes
1 answer
36 views

Converting parts of some string into another notation

I have a big string of data and most of them are in the form Name = number^{number}_{-number}, some are in the form Name = number \pm number. I what to convert the latter into the notation. For a ...
user avatar
0 votes
0 answers
27 views

How to extract detail subsection of Metadata

I am trying to get subsection of the Metadata such as image, title, url, title, description but it is impossible. Can you advise how to get this information from the follow code and results. ...
user avatar
  • 125
7 votes
1 answer
204 views

How to set deeper patterns in arguments within function definitions. For example if an argument must be a list of 1 or more strings

Suppose I want to define a function whose argument must be a List of only Strings and List must have at least one member. I know how to require that the Head must be a List but how does one qualify ...
user avatar
  • 1,837
0 votes
1 answer
58 views

automatic extracting number from a text with given signs

I am trying to get a number from a plaintext with the staring sign of "Nho xanh không hạt" and ending sign of "đ" automatically with different method but it doesn't work. In detail,...
user avatar
  • 125
4 votes
1 answer
150 views

How to display warning message inside manipulate?

Using the code shown, Reynolds number is calculated for given parameters. Is it possible to display a warning message to the user if a parameter is outside applicable range? e.g., if the fluid ...
user avatar
  • 129
3 votes
4 answers
206 views

List all substrings of a number

Need some help listing all substrings of a number X=219 The output should be Output= {2,21,219,1,19,9} Order does not matter for this problem Any help is appreciated
user avatar

1
2 3 4 5
23