Notes
![]() ![]() Notes - notes.io |
// Parameters in the string are specified as %<parameter number>. Parameter numbering starts with 1.
//
// Parameters:
// SubstitutionString – String – string pattern that includes parameters in the following format: %ParameterName;
// Parameter<n> - String - parameter to be substituted.
//
// Returns:
// String – string with substituted parameters.
//
// Example:
// SubstituteParametersInString(NStr("en='%1 went to %2'"), "John", "a zoo") = "John went to a zoo".
//
Function SubstituteParametersInString(Val SubstitutionString,
Val Parameter1, Val Parameter2 = Undefined, Val Parameter3 = Undefined,
Val Parameter4 = Undefined, Val Parameter5 = Undefined, Val Parameter6 = Undefined,
Val Parameter7 = Undefined, Val Parameter8 = Undefined, Val Parameter9 = Undefined) Export
If SubstitutionString = Undefined Or StrLen(SubstitutionString) = 0 Then
Return "";
EndIf;
Result = "";
StartPosition = 1;
Position = 1;
While Position <= StrLen(SubstitutionString) Do
StringChar = Mid(SubstitutionString, Position, 1);
If StringChar <> "%" Then
Position = Position + 1;
Continue;
EndIf;
Result = Result + Mid(SubstitutionString, StartPosition, Position - StartPosition);
Position = Position + 1;
StringChar = Mid(SubstitutionString, Position, 1);
If StringChar = "%" Then
Position = Position + 1;
StartPosition = Position;
Result = Result + "%";
Continue;
EndIf;
Try
ParameterNumber = Number(StringChar);
Except
Raise NStr("en='SubstitutionString source string has an invalid format: %'" + StringChar);
EndTry;
If StringChar = "1" Then
ParameterValue = Parameter1;
ElsIf StringChar = "2" Then
ParameterValue = Parameter2;
ElsIf StringChar = "3" Then
ParameterValue = Parameter3;
ElsIf StringChar = "4" Then
ParameterValue = Parameter4;
ElsIf StringChar = "5" Then
ParameterValue = Parameter5;
ElsIf StringChar = "6" Then
ParameterValue = Parameter6;
ElsIf StringChar = "7" Then
ParameterValue = Parameter7;
ElsIf StringChar = "8" Then
ParameterValue = Parameter8;
ElsIf StringChar = "9" Then
ParameterValue = Parameter9;
Else
Raise NStr("en='SubstitutionString source string has an invalid format: %'" + ParameterValue);
EndIf;
If ParameterValue = Undefined Then
ParameterValue = "";
Else
ParameterValue = String(ParameterValue);
EndIf;
Result = Result + ParameterValue;
Position = Position + 1;
StartPosition = Position;
EndDo;
If (StartPosition <= StrLen(SubstitutionString)) Then
Result = Result + Mid(SubstitutionString, StartPosition, StrLen(SubstitutionString) - StartPosition + 1);
EndIf;
Return Result;
EndFunction
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team