Visual Basic 6 function "ucfirst"

Go back

Below you'll find the source for the Visual Basic 6 function ucfirst.

Attribute VB_Name = "modUcfirst"
' This function is downloaded from:
' You may freely distribute this file but please leave all comments, including this one, in it.
' @Author Stefan Thoolen <>

Option Explicit

' Make a string's first character uppercase
' Same syntax as the PHP function 'ucfirst'
' See also:
' @param    String  tstr        The input string
' @return   String              The string with the first char to upper case
' @author   Stefan Thoolen <>
Public Function ucfirst(tstr As String) As String
    ucfirst = UCase(Left(tstr, 1)) & Right(tstr, Len(tstr) - 1)
End Function