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:
' http://www.stefanthoolen.nl/archive/vb6-functions/
' 
' You may freely distribute this file but please leave all comments, including this one, in it.
' 
' @Author Stefan Thoolen <mail@stefanthoolen.nl>

Option Explicit

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