General discussion

Locked

function

By mei_cbbc764 ·
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)

This conversation is currently closed to new comments.

6 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

What Language?

by JackOfAllTech In reply to function

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

Collapse -

In BASIC

by GuruOfDos In reply to function

Input String1$
String2$=Left$(String1$,1)

Piece of cake!

Collapse -

In BASIC

by GuruOfDos In reply to function

Input String1$
String2$=Left$(String1$,1)

Piece of cake!

Collapse -

Or as a BASIC function

by GuruOfDos In reply to function

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$

Collapse -

MS Excel

by Thamer In reply to function

T thamer
=LEFT(PROPER(B1))

Collapse -

MS Excel Functions

by Thamer In reply to function

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?

Back to Desktop Forum
6 total posts (Page 1 of 1)  

Related Discussions

Related Forums