Quantcast
Browsing all 186 articles
Browse latest View live

StringContainsQ And

I'm looking to test whether a string contains all substrings in it, independent of each substrings location.For example:StringContainsQ[{"abcd", "cdab", "acdb", "abdc"}, "ab" ~~ ___ ~~ "cd"]Results...

View Article


Select upper case list items with spaces and punctuation

I have a sample list that includes people's names in Title Case, and their companies in UPPER CASE. list = {"Bob Jones", "ACME-SYSTEMS", "John Smith", "FUTURETECH123", "Sally Jones", "CITY SCHOOL",...

View Article


StringJoin fails in .m

Do[( ND$T$thr[j] = j; ND$T$thr[j] >> "test_" <> ToString[j] <> ".dat"; ), {j, 1, 3}]This works without issue in a notebook and creates 3 files with different file names and different...

View Article

How to return a default value if no match is found in search of string

Suppose I have a string like "a-1_b-2_c-3_d-4" with numbers, labels, and separators, and I want to get {a-> 1, b-> 2, c-> 3, d-> 4}, I can do something like: string1 =...

View Article

How remove specified substring and everything after it to the end of a string?

If I have, say, the string,txt = "now is the time for all (good) men"then I want to remove the substring beginning with "for" and ending at the end of the string, namely, remove:subtext = "for all...

View Article


How to replace a space by a comma

in this expression = "{1 2 3 4 5 6 7 8}", I want to replace each space by a comma , to get {1,2,3,4,5,6,7,8}.

View Article

Replacing whitespace in a list with comma and turning into sublists

I have the following list: l={"1 atattaggtt tttacctacc caggaaaagc caaccaacct61 ctctaaacga actttaaaat ctgtgtagct gtcgctcggc121 gcagtataaa caataataaa"}which I want to turn into:...

View Article

Image may be NSFW.
Clik here to view.

Fill in a table with some words letters

I have a list of wordslist={"ingenuous", "forgotten", "tree", "supercomput", "hundred"}How can I put the letters of each word in an element of a table such as here:

View Article


How to delete a pattern from String?

Having a string like :"{Aaaa -> a, Bbbb- > b, Cccc -> , Ddddd -> c, Eeeee -> , Fffff -> e}"I want to delete the parts that contain "a word"+"-> ," and replace them just with "," to...

View Article


StringContainsQ, but anywhere in order

I am trying to find a string within a string, but "anywhere", so long as it is in the right order. For example StringContainsQ["aabbc","ac"]returns Falsebut I want True, since ac does in fact occur...

View Article

What is the correct pattern to DeleteCases from a list?

I'm trying to get better with pattern matching but even after years of using MMA it's still a murky concept. The docs are actually pretty good in this regard but I still struggle. In this situation I...

View Article

How to Control StringContainsQ

I have the following codeedges = {N5001 -> N1003, N50012 -> N1099, N5003 -> N48059, N50035 -> N22007, N2345 -> N5003};edges2 = ToString /@ edges;edges3 = ToExpression@ Select[edges2,...

View Article

How to Pick Out Strings of a Specified Length

Suppose I have the following edge set:edges = {N500122 -> N5003, N50012 -> N1099, N5003 -> N48059, N5003 -> N22007, N234544 -> N5001, N3010->N2111}I'm looking for this...

View Article


Convert elements of list to string

how easily can I convert elements of this list to string.If I have output like this:{{M, 1, 0, 0, 1, 1, 1, 0}, {A, 0, 0, 0}}And I want something like this:{{M, 1001110}, {A, 000}}Or{{M, "1001110"}, {A,...

View Article

Finding the longest word in a list (WordList[])

Hi guys I am having problems with finding the longest word available in WordList["English"]I have found that the longest word has 24 characters thanks to this line Max[StringLength[WordList[]]]but I...

View Article


Delete all strings that are prefixes of another string

I have a long list of strings and I'm trying to find a more efficient way of removing those elements that are prefixes of another:example = {"Clothing", "Clothing/Accessories",...

View Article

Position and string patterns

I am trying to get Position work with patterns.I have the following code:dat = {"star", "u", "g", "r", "i", "z", "star2", "u", "g", "r", "i", "z", "star3", "u", "g", "r", "i", "z", "star4", "u", "g",...

View Article


Internal`MRealToString Gives Scientific Output From Large Inputs. How To Stop...

The undocumented Internal`MRealToString works just fine for reals up to 999999. For anything over it outputs scientific notation. I don't need scientific, I need simple...

View Article

Replace $n$-th occurrence with number $n$

How can I replace $n$-th occurrence with number n for string/for list?For string :StringReplace["amkwajefiwaeah", "a" -> "A"]"AmkwAjefiwAeAh"But how can I get"1mkw2jefiw3e4h" or"A1mkwA2jefiwA3eA4h"...

View Article

What if we don't have a Pitagora theory today., [closed]

Is that just a coincidence or something else that we should know before we can make a decision about how and why is that like that.. or this is just a way for us to never understand the world and the...

View Article
Browsing all 186 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>