Strings

The VBA code fragments below are included in the Code-VB fragments library. Fragments are snippets of code you can insert in your procedures. Each item between braces correspond to a variable of the given type. They are replaced with the new or existing variables by Fragment Builder in Code-VB tools.

Add Single Quotes

{STRING} = "'" & {STRING} & "'"

If Len gt 0

If Len(STRING) > 0 Then 

If Len gt 0 Else

If Len(STRING) > 0 Then
    
Else

End If

Loop Chars in String

For {INTEGER} = 1 To Len({STRING:str})
    {STRING:char} = Mid({STRING:str}, {INTEGER}, 1)
    
Next

Make First Character Uppercase

IIf(Len({STRING}) > 0, UCase(Left({STRING}, 1)) & Mid({STRING}, 2), "")

String Append

{string:str} = {string:str} &  {string:str1} 

TRIM

{STRING} = Trim$({STRING})

Use Default If Empty String

If Len({STRING:str}) = 0 Then
    {STRING:str} = {STRING:Default}
Else
    {STRING:str} = {STRING:str}
End If

Strings Use Default If Empty String