From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

scan string for tokens

Hello all,

 

in the function: scan string for tokens

can sb explain me the difference between the 2 inputs: operators and delimiters?

LV help did not help!

 

Regards,

Samira

0 Kudos
Message 1 of 13
(5,418 Views)

Its explained well with a good demo in the help file.

 

Scan String For Tokens Details

Tokens are text segments that typically represent individual keywords, numeric values, or operators found when parsing a configuration file or other text-based data format. You can specify tokens with the data you pass into the function through the delimiters and operators inputs. For example, because the space character is a delimiter by default, each word of This is a string is a token, and you can parse the sentence into its component words.

Use this function in a While Loop that processes one section of string at a time until token index returns –2 (indicating end of string). You can pass offset past token through a shift register into offset, so that each scan starts where the preceding scan ended.

By default, the function identifies and returns a token when it encounters a space, tab, carriage return, or linefeed. You can parse a string using these or any other delimiters you choose or you can define operators.

For example, suppose you wire the following values to the function.

InputValue
input string This is a testLabVIEWstring
offset 0 (default)
operators [NI,asdf,LabVIEW]
delimiters \s,\t,\r,\n (default)

If you place the function in a While Loop, the function returns the following values.

First Iteration

dup string This is a testLabVIEWstring
offset past token 5
token string This
token index –1 (not an operator)

Second Iteration

dup string This is a testLabVIEWstring
offset past token 8
token string is
token index –1 (not an operator)

Third Iteration

dup string This is a testLabVIEWstring
offset past token 10
token string a
token index –1 (not an operator)

Fourth Iteration

dup string This is a testLabVIEWstring
offset past token 14
token string test
token index –1 (not an operator)

Fifth Iteration

dup string This is a testLabVIEWstring
offset past token 21
token string LabVIEW
token index 2 (second item in operators)

Sixth Iteration

dup string This is a testLabVIEWstring
offset past token –1 (no more tokens present)
token string string
token index –1 (not an operator)

Seventh Iteration

dup string This is a testLabVIEWstring
offset past token –1 (no more tokens present)
token string (end of string)
token index –2 (end of string)







CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 2 of 13
(5,409 Views)

Thanks aCe but as i said LV  help did not help.

I have the following string as input to a scan string for tokens in a while loop, so that it be devided into substrings:

 

 

sRA LMDscandata 1 1 8A3EFE 0 0 A11F A124 B33C1 B4289 0 0 7 0 0 9C4 168 0 2 DIST1 3F800000 00000000 FFF92230 9C4 43A 3C8 3C4 3B8 3BC 3CA 3D0 3D5 3D4 3DC 3EE 3F0 3E7 3FB 3FF 3F6 404 40B 408 415 41E 423 422 427 42D 42A 430 43E 431 440 435 3C1 311 2E0 2CB 2AE 2AC 2AD 2A4 2A5 286 284 286 26D 258 228 229 220 223 21E 209 205 1F2 1FA 1EF 1F4 1E2 1F0 1DC 1D2 1D5 1C3 1D4 1D9 1C9 1CE 1C9 1D1 1D7 1DB 1CD 1CB 1C9 1C9 1C9 1C9 1D9 1CB 1C6 1CD 1C2 1C0 1C1 1C4 1C9 1CE 1D3 1D0 1D2 1D4 1CD 1C9 1CB 1CA 1C6 1C1 1D0 1DE 1E8 1F0 1F1 1EF 1F5 1FE 215 20D 213 22F 233 250 249 23E 24A 238 23E 238 23D 245 248 24F 254 244 24D 254 239 232 224 25A 280 2A7 2C6 2DF 2EE 2FC 2F3 300 30C 2FB 318 338 362 355 362 35C 35D 354 32C 30E 2FF 2DA 2C1 2C7 344 375 39E 39C 23B 220 3C4 3B0 3DD 455 4F3 545 52C 4D4 498 479 4A6 51D 575 5B2 5E3 652 744 8EA 91F 916 915 91D 922 90C 914 915 907 914 906 90C 90C 900 903 8FD 8F9 8F2 8F9 90E 8E9 907 8FA 8F5 8ED 8F3 8E8 8F4 8EA 8ED 8E8 8F9 8E2 8F6 8EC 8E7 8E8 8E0 8F5 8EB 8D9 8EC 8EB 8E5 8E7 8DB 8E4 8DC 8DD 8E4 8F0 8D7 8EA 8DE 8DC 8EE 8D6 8EC 8DC 8E2 8E4 8B6 79E 5EE 5BC 5A4 58E 58F 58E 590 59A 59C 589 587 596 58C 58E 580 58E 58E 57F 586 580 58A 57C 579 58A 588 57C 58B 57B 596 5A2 5A7 595 5A0 599 584 598 5A5 58B 597 58A 590 58A 58E 587 5A0 5FB 650 64C 64B 64A 6AE 721 881 8F0 8F1 8FA 8F8 8F8 8FA 8F0 900 907 90B 90E 918 905 914 919 90E 4EA 3E1 39E 373 34A 349 364 390 428 92B 937 93B 937 93D 956 94F 93D 949 966 96E 967 978 98F 997 9A1 9A5 9A8 9A3 9A5 5C6 4C8 4BB 4D2 4EC 4EB 500 4FD 4F3 4F2 0 0 0 583 833 BED 873 73E 706 6EA 7C8 29E 2A0 2BD 2D6 2DB 2DE 2DB 2D4 2C6 2BF 2D4 2C5 2A2 272 25D 25F 245 253 273 286 29B 2B0 2A7 2A1 2AC 29C 295 29E 2E2 334 389 3B9 3B6 3B4 3C1 3A4 38A 377 383 387 37D 35C 359 350 353 34B 346 33D 330 323 30C 2FF 302 2F2 2FF 311 314 314 327 303 E7A E7D E62 35C 362 378 E16 E15 8FD 7B7 76B 709 6F8 704 738 770 7E0 6FD D38 D28 D1B D0A D10 D08 CFE CE2 CD4 CCE 863 75B 706 6D4 6B8 691 69A 66A 65A 651 64F 654 64D 652 63D 632 638 633 633 635 636 631 622 629 63C 624 624 62E 620 629 629 621 628 632 633 656 685 6D7 81A B6F B5F B5F B5A B4C B45 B31 B37 B39 B27 B2C B18 B25 B15 B07 AF8 AEC AFB AE9 AE4 AD3 AD4 ACD ACB AC0 AAC AC0 AB5 AC8 AB7 AAC A95 AAA A90 A84 AA3 A8C A90 A97 A85 A7F A7B A82 A75 A5C A6E A75 A74 A67 A58 A51 A43 A2C A46 A31 A32 A40 A2A A2B A18 A28 A1E A1D A2D A23 A39 A10 A10 A19 A08 A0C A0B A13 A12 A1C A12 A1F A1C 228 232 223 21F 208 210 21B 203 201 202 206 207 202 207 20C 20F 208 1FF 1FD 208 1FD 1FB 20C 20B 1FA 201 219 20C 210 214 1FD 20A 20E 20E 214 201 217 216 201 201 20A 207 215 208 207 20B 20A 210 203 20B 219 215 211 204 210 213 1FC 20F 212 208 20B 20A 204 20B 20E 1FF 210 212 221 219 211 211 219 210 21E 211 21B 21C 21C 213 217 20D 220 211 21C 21B 22A 223 237 2CE 2FC 27D 2C9 2D0 2D7 458 4B8 58D A51 A45 990 721 697 625 5BB 538 4B2 465 41B 3F3 3E0 3B9 3B3 399 37E 386 36D 35D 352 349 347 344 33D 338 31A 31B 317 31E 30D 319 311 307 319 318 312 309 318 314 322 32C 32D 32C 320 332 346 34A 341 34B 34C 359 35C 347 358 36A 39C 3E6 3FF 391 B76 B76 B64 B7C B74 B88 B92 B86 BA8 B97 BAB B9E BB4 BC9 BC6 BDD BDF BE9 BFC BEC C0D C0F C0E C25 C2A C2C C3D C46 C3B C4B C6E C66 C7B C81 C8C C8A CA1 C98 CAF CD3 CDC CE6 CED CF6 D15 D16 D21 D27 D37 D56 D56 D5A D73 D88 D95 D9A DA9 DBF DCE DE0 DE3 E00 E0B E1B E1B E3E E56 E45 E63 E82 E8B E91 EA5 E34 E02 DDF DCD DEB DF6 E0F E2C E32 E51 E73 E88 E9B EAF ED0 EF0 F0B F21 F48 F5C 129 158 155 14F 150 141 13F 136 141 135 138 13A 124 137 138 12E 131 133 12D 132 134 132 132 12C 12E 125 12D 12F 133 139 122 10D 116 120 121 109 118 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8E 79 88 6B 5F 63 74 72 55 0 4B 2F 43 5F 69 5D 5E 4D 4F F 0 0 0 0 9 53 5C 53 6A 6E 69 78 8B 88 9E A4 AF BA C4 CD C2 D0 D1 DA DB D8 E3 EC F5 F8 E9 F8 F4 EF EE F3 F2 F1 EB DE EC EE DF E3 E9 E3 E4 E7 D7 DA D9 E0 D5 E4 E8 DA D2 D3 DE E3 D3 D2 D5 CD E0 DC E2 DA DD EA E7 D8 EC EB EB FE EF F6 CB C0 C9 BA 0 0 0 0 0 0 0 D6 C9 D4 C2 D8 D2 C8 CD BB CF B9 D8 D4 CB C4 C5 CB 0 0 B3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C2 F3 107 10F 118 FB E7 E1 102 113 115 111 FE 109 105 104 EE 102 F8 FA EC EA F7 EC F6 EC FC FC FF F9 FA FD 104 101 F4 FC 106 107 109 10E 105 10E 118 10F 10C 131 114 F1 0 0 0 AC0 ACC AB6 AB5 AA3 A6E A5F A6F A66 A68 A76 A82 A78 A87 A88 AA6 AAF AB5 RSSI1 3F800000 00000000 FFF92230 9C4 43A 160 161 161 160 161 15E 15E 15F 163 165 165 167 166 166 167 168 167 169 16B 16A 16A 165 167 16A 168 169 16A 16E 16D 173 18B 1B4 1D5 1EF 203 218 228 234 23D 23F 23F 237 22C 21B 210 20E 20E 20C 213 219 223 228 228 226 226 22E 235 23F 246 251 25C 264 26A 269 269 265 264 260 25F 25B 25F 263 268 26B 26E 26F 270 274 275 275 276 277 276 276 275 273 271 26B 266 25B 252 247 23F 236 22C 223 21E 218 217 219 218 20F 206 202 203 207 206 1FF 1EE 1DD 1CB 1BB 1AA 19F 19A 194 198 1A1 1A7 1B8 1BD 1C2 1CA 1D1 1CE 1B9 1A8 1A2 1A8 1B5 1CB 1E4 212 23D 260 26E 267 24C 245 253 25D 25F 255 246 24A 24E 252 245 233 223 214 2C3 305 323 340 13E 127 346 321 2D4 29A 283 28F 2B0 36F 3A0 3CA 38D 2B2 287 27E 27E 28A 28E 24F 258 25A 25C 25C 25D 25C 25C 25C 25D 25F 260 25F 25B 25F 261 261 261 261 262 262 261 261 25B 25D 25D 263 263 263 264 265 265 267 263 263 267 265 264 264 264 267 267 26B 26A 26A 26C 26E 26B 26E 26D 26A 26D 26B 26D 271 271 272 26D 271 26E 272 274 27C 2B2 2F9 2E4 2AC 294 292 292 293 292 292 28E 292 28D 291 291 28E 28C 290 292 28D 291 28D 28B 28C 28D 28A 28A 287 28C 295 297 295 295 290 290 294 28E 291 28E 291 28E 28E 28A 28A 285 2AB 2BA 2BA 2BC 281 213 266 297 26D 260 261 262 25D 25D 25E 25D 25D 25B 258 258 258 255 251 24D 240 319 321 2F8 2E4 2CD 2B0 2F6 32C 330 221 21F 21C 21A 212 20D 207 205 1FB 1F5 1ED 1E2 1E0 1D4 1D2 1CC 1C2 1B6 1A6 190 23E 193 193 153 11C 136 14F 14B 124 99 0 0 0 D7 29B 1F4 2E3 318 2FD 2C1 233 8F D2 E5 F0 FA 105 103 109 107 10A 10E 110 132 17B 1A8 1C5 1D0 1B5 172 106 115 139 14A 154 12B 109 100 102 116 133 133 139 147 151 158 158 154 155 15A 159 16A 17C 185 191 19A 1A9 1B5 1CB 1D0 1D9 1DC 1E1 1E4 1F0 1FC 201 1F3 1C8 17E D2 210 211 205 83 C2 BF 201 21A 344 356 310 23E 23D 237 2AB 322 34D 7E 239 23A 23C 23D 242 242 23E 241 23F 245 334 334 2EC 271 247 232 22B 23B 255 269 26F 275 272 273 273 279 27A 27D 278 277 275 26C 268 272 274 275 273 274 271 26E 26B 26B 264 25E 25B 29D 304 338 312 25E 259 260 25F 25E 25E 25D 25E 260 260 262 262 264 263 25E 252 240 22E 221 21E 22A 22E 232 234 22F 231 22F 232 231 231 231 22E 231 22F 22D 233 230 231 234 233 235 235 236 234 237 237 23A 23C 23D 23E 23D 23A 23C 23F 242 24A 250 24E 24C 241 236 235 239 241 241 240 241 249 256 259 259 25A 25C 25D 25D 252 24B 23D 119 176 1A8 1D1 1EA 1F5 1F9 201 204 206 207 20A 208 207 207 204 205 203 204 204 203 203 203 207 204 207 205 206 206 205 202 205 202 200 201 201 204 204 204 206 208 207 207 208 202 204 200 1FF 1FD 1FC 1FD 1FD 202 201 204 209 20A 20E 20F 20E 20C 20A 204 205 204 201 203 203 201 203 202 203 205 202 201 201 203 201 203 201 201 1FE 1FB 1FB 1FB 1F9 1F5 1F2 1E8 32F 34D 17D 154 146 142 323 2FD 317 234 24F 28B 312 315 2ED 2B0 29C 2B5 2C0 2CA 2CE 2CF 2C1 2B1 294 296 295 289 27A 271 26E 26A 268 266 268 265 265 265 264 265 267 264 264 264 261 260 260 25F 261 260 262 262 25E 25F 260 262 260 260 260 260 25F 25F 25F 25E 25B 315 386 3BC 109 250 253 252 254 24F 251 253 24E 24E 24C 251 24E 24A 24A 247 246 249 248 24A 245 247 243 243 243 241 243 243 242 23C 23D 23D 23D 23E 23E 23A 238 235 22B 229 228 22A 226 225 228 223 21D 21F 223 229 22D 22B 230 22D 229 228 225 227 228 228 225 228 223 222 220 220 21D 21C 21D 21A 21D 21C 218 21A 223 21C 20A 1F9 1ED 1E9 1E4 1E2 1DF 1DA 1D8 1D5 1CE 1CA 1C2 1BA 1B0 1AA 19A 192 E3 13D 17B 19A 1AE 1BE 1C5 1CF 1D6 1DC 1E1 1DF 1DE 1E5 1E7 1EC 1EB 1E4 1DF 1DC 1D3 1C6 1C0 1BC 1BA 1C0 1B7 1A0 177 140 FB D4 BF A8 BF D6 C6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5A 76 9D A5 B6 AC AA 9F 8D 0 86 D3 109 13D 161 17D 18E 19C 1A8 1B2 0 0 0 0 1B6 1AC 19D 18C 17F 16A 150 12A 10C FC FD 107 111 116 124 12A 12E 137 13C 140 143 146 14E 152 159 15D 164 163 16F 170 176 17B 17E 182 186 18E 195 199 19D 1A3 1A6 1AB 1B1 1B9 1C3 1C7 1CF 1CD 1CD 1D2 1DA 1DD 1E7 1E6 1E4 1E0 1DF 1DE 1E1 1E2 1E3 1E1 1D8 1CD 1C7 1BB 1B6 1AF 1A3 19A 18D 179 164 142 11B EE C5 92 0 0 0 0 0 0 0 B7 E8 FB 101 FE F9 EC E9 DB D7 C4 C1 B9 B2 9E 99 7F 0 0 4E 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4F EB 133 146 13B 102 D6 D9 114 164 192 1B6 1CD 1D9 1DF 1E5 1E9 1F3 1F8 1FE 1FC 200 1FF 201 1FE 1FA 1FA 1F6 1F3 1F1 1EC 1E6 1E2 1E3 1E0 1E2 1E5 1E5 1E6 1E9 1E6 1E5 1DB 1C9 1A7 172 120 A8 0 0 0 80 177 1C3 1F5 215 228 233 23C 23E 244 245 241 23B 238 22D 22F 22D 217 0 0 0 0 1 7B2 1 1 2 27 1C B3EE8 0

0 Kudos
Message 3 of 13
(5,401 Views)

u see Dist1 in the first line. Can u please tell me what the attached loop does to that? what is the role of the operators input here?

 

Thanks and best regards,

Samira

0 Kudos
Message 4 of 13
(5,395 Views)

Could you tell us the expected substrings from the text you posted? Also cant see any attachments.


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 5 of 13
(5,394 Views)

u see Dist1 in the first line. Can u please tell me what the attached loop does to that? what is the role of the operators input here?

 

Thanks and best regards,

Samira

0 Kudos
Message 6 of 13
(5,390 Views)

This is the whole data read from a laser scanner. Sensor Document is attached.

0 Kudos
Message 7 of 13
(5,386 Views)

Try this.

token.png


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
Message 8 of 13
(5,369 Views)

The existance of the operators input has no effect on  the value of the ring output string in both cases. what does it do then?

0 Kudos
Message 9 of 13
(5,350 Views)

@AutonomousMode wrote:

This is the whole data read from a laser scanner. Sensor Document is attached.


You may want to have this post deleted. You do realize that your document is stamped "For Internal Use Only".



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 10 of 13
(5,340 Views)