STRING(number, character)

Returns a repeating character of a given length (Variant / String).


numberThe length of the returned string (Long)
characterThe character code specifying the character or string expression whose first character is used to build the return string (Variant)

REMARKS
* If "number" > 256, then the number used is "character" Mod 256.
* If "number" is Null, then Null is returned.
* If "character" is a number, then it is converted to a character.
* If "character" < 0, then
* If "character" > 0 and "character" < 255, then
* If "character" > 255, then
* If "character" is Null, then Null is returned
* You can use the STR function to return the text string of a number.
* You can use the STRREVERSE function to return the text string with the characters reversed.
* You can use the STRING$ function to return a String data type instead of a Variant data type.
* For the Microsoft documentation refer to docs.microsoft.com

Debug.Print String(5,"a")     '= "aaaaa"  
Debug.Print String(2,abcd") '= "aa"
Debug.Print String(3,"abcd") '= "aaa"
Debug.Print String(4,"b") '= "bbbb"
Debug.Print String(5,40) '= "((((("
Debug.Print String(5,80) '= "PPPPP"
Debug.Print String(5,"") '= run time error

© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited Top