Discussion Locked

function

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

can u help me in coding in function, coding in getting the first letter of the input phrases...
example
input: Account receivables
answer: A

i need function(coding)

6 replies

by jackofalltech

How can we possibly help you if you don't tell us what language? However...
Basic:
cFirstChar = Left$(sInput, 1)

C:
cFirstChar = sInput[0];

Ralph

by guruofdos

Function FirstChar(String1$ AS String) As String
FirstChar=Left$(String1$,1)
End Function

Then call the function like

Input "Please enter your string...";A$
B$= FirstChar(A$)
Print "Your first character was ";B$

by thamer

A1=account receivables
B2=LEFT(A1) equals "a"

Or
A1=account receivables
B2=LEFT(PROPER(A1)) equals "A" (Notice the function proper capitalized the first letter on the text in A1)

Or if
A1=[space]account receivables
B2=LEFT(PROPER(TRIM(B1))) equals "T" (Notice it did not count the space at the begining of the text since the function Trim will remove all spaces from the text except for single spaces between words.

... hmmm, what about the possibility of an entery which starts witha number and space or a compination of both ex. " 9 account receivables"? ... is it possible that you will have such input?

This discussion is closed to new replies.