Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Answers on String Manipulation

Featured Replies

Do you recognize this list? Looking in our forum I have noticed that any questions on the subject of string manipulation will get very little response if any. With this tutorial I will try to put an end to that. Took me some time to sort it out and I will share it with you today.The examples below can be reconstructed and/or combined. I will give you only the essentials!lc Converts a string to lowercase.uc Converts a string to uppercase.cap Capitalizes a string.chr Converts a number to a symbol.ord Converts a symbol to an integer.scat Concatenates strings.schr Finds a symbol in a string.scmp Compares strings.scmi Compares strings, ignoring case.sstr Finds a substring.ssub Extracts a substring.symb Extracts a single character.slen Will return the length of a stringThe ord instruction converts a symbol also called character into it's ascii code (integer) The chr instruction converts an ascii code (integer) into a character or symbol if you like. They are the same. - slen - Example 1. Length of the designation string '01L-19R' Will return 7 (@c:WaypointAirportRunwayDesignation) slen (>;L:Rqylength, number) - scmp - Example 2. Compare strings. If equal will return -1 With the '!' added it will return 1 so if{} can be used. (@c:NearestAirportCurrentIdent,string) 'EHAM' scmp ! (>L:Var5, bool) - scmp - Example 2a. Compare strings. Test String for Airport ICAO. 0 (>L:TransitionLevel,enum) c (@c:NearestAirportCurrentIdent,string) sp0l0 'EHAM' scmp ! if{ 40 } l0 'EGLL' scmp ! if{ 70 }(>L:TransitionLevel,enum) - sstr - Example 3. Find a substring. Test ICAO string for Country.(@c:NearestAirportCurrentIdent,string) sp0 l0 'EH' sstr ! if{ 3000 } l0 'EG' sstr ! if{ 6000 } l0 'ED' sstr ! if{ 5000 } (>L:Inflight_TA,number) - schr - Example 4. Find a character in a string. Will return the position of the symbol starting with 0 in the string '01L-19R' 'L' L:found will return 2 'R' will return 6(@c:WaypointAirportRunwayDesignation) 'L' ord schr (>L:Lfound,number) (@c:WaypointAirportRunwayDesignation) 'R' ord schr (>L:Rfound,number) - ssub - Example 5. Extract part of a string. From '01L-19R' '01L' will be extracted. The result cannot be entered into a variable but it can be printed!Notice the 0 3. 0 is the starting point and 3 the length%Deel1 %((@c:WaypointAirportRunwayDesignation) 0 3 ssub)%!s!- ssub - Example 5a. Extract part of a string. From 'Amsterdam' 'ster' will be printed.Notice that here only one pare of brackets must be used! %Substr %( 'Amsterdam' 2 4 ssub )%!s! - uc - Example 6. Output in uppercase From 'Amsterdam' 'ster' will be converted to 'STER'%Substr %( 'Amsterdam' 2 4 ssub uc)%!s! - cap - Example 7. First symbol will be converted to capital. From 'Amsterdam' 'ster' will converted to 'Ster' %Substr %( 'Amsterdam' 2 4 ssub cap)%!s! - symb - Example 8. Extract one character. From '01L-19R' 'L' will be printed.Notice that only the pointer 2 is required. %((@c:WaypointAirportRunwayDesignation) 2 symb)%!s - symb - Example 8a. Extract one character. From 'Amsterdam' 'A' will be printed.%( 'Amsterdam' 0 symb )%!s! - scat - Example 9. Concattenation. Given: L:Var1=49 L:Var2=53 L:Var2=53 'KLM153' (my callsign) will be printed.Notice that the respective ascii codes are first converted to a symbol/character and then added.%( 'KLM' (L:Var1,enum) chr scat (L:Var2,enum) chr scat (L:Var3,enum) chr scat )%!s! - lc - Example 10. Another example? I've done my share. I will leave this lowercase instruction to you!Roelof Kruijer

great post ! thxa copy and paste for my fs9 bible

Roelof,Thanks for taking the time to share this information. Teaching by example is my kind of cake.Glenn

Thank you Gentleman for appriciating this effort.A better readable and slightly changed Word document can be found at my site: http://members.home.nl/rkruijer/ Go to the English Page! You will find the link at the top!Roelof

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.