I currently have the following problem for which I couldn't find a solution for. It's about getting a substring from a string variable...
I've a nested list of values:
\ExplSyntaxOn \NewDocumentCommand{\DeclareListOfValues}{ m m } { \clist_gclear_new:c {g_list_of_values_#1_clist} \clist_gset:cn {g_list_of_values_#1_clist} {#2} } \NewDocumentCommand{\GetValueFromList}{ m m } { \clist_item:cn {g_list_of_values_#1_clist} {#2} } \ExplSyntaxOff %List structure: {TotResClassA,TotResClassB,TotResClassC,TotResClassD,TotResClassE} \DeclareListOfValues{GraphiteArrangementClassesTotalRes}{70.2,29.8,0,0,0} %List structure: {{ImgName,ResClassA,ResClassB,ResClassC,ResClassD,ResClassE},{...},{...},...} \DeclareListOfValues{GraphiteArrangementClasses}{ {14-1-11,73.6,26.4,0,0,0}, {15-1-4,72.7,27.3,0,0,0}, {15-1-6,67.7, 32.3,0,0,0}, {16-1-10,75.6, 24.4,0,0,0}, {1562-3-6,68.7,31.3,0,0,0}, {1562-3-16,71.6,28.4,0,0,0}, {1563-3-8,85.9,14.1,0,0,0}, {1563-3-13,71.8,28.2,0,0,0}, {1564-2-7,58.1,41.9,0,0,0}, {1564-3-14,56.2,43.8,0,0,0} }
Then I get the 1st element in the list, like shown below:
\newcommand{\teststr}{\GetValueFromList{GraphiteArrangementClasses}{1}} %teststr: 14-1-11,73.6,26.4,0,0,0
What I need to get now from this string is the name of the image, which ist 14-1-11. I tried it with xstring, but it didn't work. It only works, if teststring is some arbetrary string of comma-separated characters, like
\newcommand{\teststr}{123,2563,58888,9541278}
\StrBefore[1]{\teststr}{,} %res: 123
but not if I get the string from a list, like in my case - and I cannot understand, why and what's actually the difference!?
Would be very glad, if somebody could help me solving this!
Best regards, Michael