Items tagged with stringtools stringtools Tagged Items Feed

H, how i need to write my command to get n times of the sentences i insert.

For example, 

>teksbiasa:= `Hello Bob`;

Hello Bob

So, if i want 5 times of `Hello Bob` like 

Hello Bob Hello Bob Hello Bob Hello Bob Hello Bob 

What should i write?

Thank you ~=]]








Hi, how i need to modify my command so the length of each word can be detected if enter a sentence instead of 1 word ?

For example, if i entered >> `Hello! Bob`, so the length of each word is [6, 3], so what i need is


>teksbiasa:=`Hello! Bob`;

teksbiasa:=Hello! Bob


nilaiASCII:=[72, 101, 108, 108, 111, 33, 32, 66, 111, 98]

and my E will be >> E:=[72+6, 101+6, 108+6, 108+6, 111+6, 33+6, 32, 66+3, 111+3, 98+3] which is >>

E:= [78, 107, 114, 114, 117, 39, 32, 69, 114, 101]

Thanks for help~=]]
Have a nice day~=]]


Dear All,

I use Maple T.A. 10. I try to use StringTools[Search] in algorithm variables but have not succeeded. Any help would be appreciated.

Algorithm Variable definitions


give us the following result, whereas I expect the return value 1.

pattern1 "sin(1/2*Pi)"
text1 "sin(1/2*Pi)"
test1 com.maplesoft.server.router.MapleSyntaxException: on line 116, syntax error, `,` unexpected:
test2 module () local Testing, Bitmap, BF, SuffixArray, LyndonFactorPositions, CheckMaximalRepeat, slowLyndonFactors, SerialCorrelationCoefficient, ChiSquared, LongestCommonSubSequenceLength, PrintSentences, `difficult?`, matchMatrix2, _randperm, _permute, _config, trampoline, Sequitur, passign, defun, compressImpl, uncompressImpl; export Length, IsUpper, IsLower, IsAlpha, IsDigit, IsAlphaNumeric, IsControlCharacter, IsSpace, IsPunctuation, IsGraphic, IsIdentifier, IsIdentifier1, IsPrintable, IsASCII, IsHexDigit, IsOctalDigit, IsBinaryDigit, IsVowel, HasUpper, HasLower, HasAlpha, HasDigit, HasAlphaNumeric, HasControlCharacter, HasSpace, HasPunctuation, HasGraphic, HasIdentifier, HasIdentifier1, HasPrintable, HasASCII, HasHexDigit, HasOctalDigit, HasBinaryDigit, HasVowel, Has, ExpandCharacterClass, Random, Randomize, IndexOfCoincidence, Entropy, ArithmeticMean, Kasiski, Repeats, Explode, Implode, Chop, Chomp, Fence, MatchFence, PadLeft, PadRight, Centre, Center, Trim, TrimRight, TrimLeft, Squeeze, DeleteSpace, Reverse, Insert, Delete, IsPrefix, IsSuffix, CommonPrefix, CommonSuffix, LongestCommonSubString, LongestCommonSubSequence, Soundex, Metaphone, Levenshtein, HammingDistance, EditDistance, PrefixDistance, SuffixDistance, DifferencePositions, Compare, CompareCI, CamelCase, UpperCase, LowerCase, OtherCase, Capitalize, FirstFromLeft, FirstFromRight, Take, Drop, Snarf, CharacterMap, LeftFold, RightFold, Map, AndMap, OrMap, Char, Ord, SubString, Select, Remove, SelectRemove, Group, Split, CaseSplit, LengthSplit, StringSplit, Readability, Sentences, Words, WordStart, WordEnd, WordContaining, NGrams, SimilarityCoefficient, WordCount, Join, CaseJoin, RegMatch, RegSub, RegSubs, RegSplit, ApproximateSearch, ApproximateSearchAll, HammingSearch, HammingSearchAll, Search, SearchAll, Substitute, SubstituteAll, PatternDictionary, FormatMessage, FormatTime, ParseTime, Fill, Repeat, Iota, Visible, Escape, Encode, Decode, Compress, Uncompress, WildcardMatch, NumbOccur, CountCharacterOccurrences, Shift, Rotate, Exchange, Stem, Permute, SortPermutation, Sort, Unique, Hash, IsSorted, IsAnagram, Anagrams, SyllableLength, Generate, NthWord, Support, IsBalanced, IsSubSequence, IsPalindrome, IsEodermdrome, IsPermutation, IsDerangement, IsMonotonic, IsPrimitive, PrimitiveRoot, Border, BorderLength, BorderArray, Overlap, IsConjugate, MinimumConjugate, Period, IsPeriod, Fibonacci, ThueMorse, MonotonicFactors, LyndonFactors, LexOrder, ShortLexOrder, RevLexOrder, ShortRevLexOrder, LeftRecursivePathOrder, RightRecursivePathOrder, ToByteArray, FromByteArray, CharacterFrequencies, MaximalPalindromicSubstring, MinChar, MaxChar, Tabulate, StringBuffer, ExpandTabs, WrapText, Indent, PatternEquivalent, PatternCanonicalForm, GenerateIdentifier, _pexports; options package, noimplicit, `Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2005`; description "a package of string manipulation utilities"; end module(Search)("sin(1/2*Pi)","sin(1/2*Pi)")

I confirmed that one can use StringTools[Search] in the question source code as explained in

maple=evalb(0=StringTools[Search]("factor","$RESPONSE")) and evalb($RESPONSE=factor(x^2-1))

I note that searchtext or SearchText procedures could be used instead in algorithm variables.

These both work the same way

s1:=StringTools:-Join(["this is a ","test"]);
s2:=cat("this is a ","test");

When should one not use cat() command? It seems much simpler than Join. Are there cases where cat() will not work and Join will work?

I am looking to return all the substrings of a string that match a particular pattern (regexp). This is a very common text processing operation.

StringTools[RegMatch] returns boolean about whether the given pattern exists somewhere in the string. That's a start, but it is not efficient to hunt around for where the match is in order to extract the characters.

StringTools[Search] and [SearchAll] can return position information, but they work on exact matches of the pattern space, not on regular expressions. I could pre-generate all the possible matching sequences of up to some length and search for those exactly, but that is inconvenient at best and pretty much useless if there is a .* or .+ in the regular expression (as the space of potential matches grows exponentially.)

StringTools[RegSub] can be used to find one match by using something like ".*(REALPATTERN).*" = "\1" but since this does not extract any position information, one would at the very least then have to StringTools[Search] of the exact match to determine the position, then take a substring of the original string, and continue searching. And if you are going to do that, you might as well just use StringTools[RegMatch] with an optional third argument of a symbol to return the matched characters, instead of fooliing around with deleting everything else using RegSub.

Have I overlooked a possibility?

Example of use:

I would like to search "variable %1 needs to be of the form %3+2.9 in order to use routine %2 to find the fizturl", extracting the "%1", "%3", "%2". This would be regular expression "%[0-9]+". Notice that there might be other digits in the string that I do not want to extract, so I cannot just search for digits. I also cannot just remove all characters "[^0-9%]" as that would leave digits and would, for example, merge together the %3+2.9 into %329 leaving post-processing to extract the true pattern matches.

For what I am doing at the moment, I do not need to know the positions those occured at, just the matches.

Strings := {"buffalo", "zebra", "aardvark", "aardwolf", "anteater", "antelope", "bumblebee"};
{"buffalo", "zebra", "aardvark", "aardwolf", "anteater",

"antelope", "bumblebee"}
CP := {seq(seq(StringTools:-Take(x, StringTools:-CommonPrefix(x, y)), x in Strings), y in Strings)};
P := table(map(proc (x) options operator, arrow; x = "" end proc, Strings));
for x in CP do for y in `minus`(CP, {x}) do if `and`(StringTools*IsPrefix(y, x), `implies`(assigned(P[x]), StringTools*IsPrefix(P[x], y))) then P[x] := y end if end do end do;
Error, cannot determine if this expression is true or false: StringTools*IsPrefix("a", "")


Hi I tried to apply these command in maple to see hoe cluster graphic after that can work .. but i face this problem ,


I am a begginer in maple working on it for a term paper to demonstrate it is ability to view the cluster analysis .


if u have any benefcial resources I ll be so happy.


thanks very much

We have two texts in a certain language, represented as Maple  strings,  e. g.
"die einkommen der landwirte sind fuer die abgeordneten ein
buch mit sieben siegeln um dem abzuhelfen muessen dringend alle
subventionsgesetze verbessert werden" and
"die steuern auf vermoegen und einkommen sollten nach meinung
der abgeordneten nachdruecklich erhoben werden dazu muessen die
kontrollbefugnisse der finanzbehoerden dringend verbessert werden".
We have to find the maximal common subsequence of the words in the both texts,
i.e. "die  einkommen der abgeordneten muessen dringend verbessert werden" for
the above. If there are a few such ones, then only one is enough. How to program
that by SringTools and/or EssayTools in maximum efficient way? A compiled procedure is welcome.

 i have big problem, i dont know, how to add 0 in front.
firstly, i convert decimal to binary and  then i convert to string

but, how i add some 0 in front??
for exmple below..


i want to look like 7 bit

i dont know how to count all digit, and how to add some 0 to front , and also have 7 bit?

I have a message, "I Didn't See That Double Rainbow!" and i want to encrypt it by making all the characters UpperCase first and removing all punctuation. I used IsUpper to remove the punctuation. Now I want to separate my new scrambled message into BLOCKS OF 5 LETTERS SEPARATED BY SPACES. Any ideas on how to do that using the "printf" command?



Several months ago, I'd posted a two-letter-words quiz and a two-to-make-three quiz meant for fans of the Scrabble game. Here is a third worksheet that tests your ability to find anagrams of seven-letter words. The worksheet is structured around six-letter stems and the lists of seven-letter...

In a string, how can I find a letter of both upper and lower case?

ie/ something like

StringTools[SearchAll]("h" and "H" , string)

Some time ago, I posted a two-letter-words quiz for Scrabble players. That one is particularly useful to beginner players wanting to increase their scoring opportunities. I've created another worksheet for those looking for a greater challenge. This one tests your knowledge of the three-letter words that can be created from the valid two-letter words. Enjoy!

Many years ago, I played Scrabble competitively. One of the first things a beginner tournament player should do is learn the two-letter word list. Recently, I created a worksheet that tests your knowledge of all the valid two-letter words accepted in official tournament play in North America. The worksheet makes extensive use of the StringTools package which has terrific tools for manipulating words.

The worksheet link is below if you'd like to try it out, and I'll...


I need a procedure to unjumble a series of 9 letters into discernable 4 to 9 letter words. each letter can only be used once and it needs to include a given letter in each word. eg IOCMRELAE, and include R in each word

Acer did a similar thing a while back, but in this case it needs to tell it to permute 9 letters, then 8,....,then 4 (each including letter R).

 >with(StringTools): with(PatternDictionary):
>bid:= Create(`builtin`):


I expect the first call to Length to return a value of 63.  The backslashes are being ignored.  Is this a "feature", or is the Length command not behaving as it should?

1 2 Page 1 of 2