format strings
-
Hi all, I have a string (for example itcontains "abcde"). I'd like to fill it with spaces until a determined length (for ex. 10) so the final string would be "abcde " How can I do it? Thanks in advance, Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
-
Hi all, I have a string (for example itcontains "abcde"). I'd like to fill it with spaces until a determined length (for ex. 10) so the final string would be "abcde " How can I do it? Thanks in advance, Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
Marc Soleda wrote:
final string would be
Dim StrLength as Int32 = 10 Dim myString = "abcde" Dim addSpace as Int32 = 10 - myString.length Dim I as Int32 For I = 1 to addspace mystring = mystring + " " next
:wtf:
What a curious mind needs to discover knowledge is noting else than a pin-hole.
-
Hi all, I have a string (for example itcontains "abcde"). I'd like to fill it with spaces until a determined length (for ex. 10) so the final string would be "abcde " How can I do it? Thanks in advance, Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
strABCDE.PadRight(10)
That will take into account the length that already exists and then add the number of spaces or characters in order to finish filling to the required length.
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy
"Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School) -
Marc Soleda wrote:
final string would be
Dim StrLength as Int32 = 10 Dim myString = "abcde" Dim addSpace as Int32 = 10 - myString.length Dim I as Int32 For I = 1 to addspace mystring = mystring + " " next
:wtf:
What a curious mind needs to discover knowledge is noting else than a pin-hole.
sorry, I missed to tell that I'm looking for a Framework function . For example: I've done the same but filling it with "0" with the "Format" method but with spaces I can't do it. Is there something similar with spaces? Marc
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
-
sorry, I missed to tell that I'm looking for a Framework function . For example: I've done the same but filling it with "0" with the "Format" method but with spaces I can't do it. Is there something similar with spaces? Marc
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
Format()
is a VB6 function and for the padding function there is now a.PadLeft
and a.PadRight()
.
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy
"Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School) -
strABCDE.PadRight(10)
That will take into account the length that already exists and then add the number of spaces or characters in order to finish filling to the required length.
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy
"Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)Great !! That's exactly what I was looking for. thanks, Marc.
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits