Re: Converting Type Characters to type string



On Apr 1, 6:22 am, jedivaughn <jedivaugh...@xxxxxxxxx> wrote:
What I'm doing is taking the first character the user enters and
looking at it to determine whether or not it is a integer roman
numeral or the letter Q (for quit). if it's a integer then I need to
convert the single character to a roman numeral and I take the rest of
the input as a string and convert it to an integer using

int := integer'value(char);

so basically I then need to know how to convert the single character I
used to determine whether or not the input was a integer roman numeral
or the letter Q to an integer. And then I can add it to the integer to
find the roman numeral vlaue.

I think you're really on the wrong track. Assuming you've taken my
advice and are using Get_Line to read an entire string first, you can
look at the first character of the string to see whether it's Q or a
digit. Once you've done this, the input string will still be there in
its entirety, including the first character that you've checked for
'Q'. So why do you need to convert that one digit to an integer? You
can still convert the entire input string using Integer'Value.

Even if for some reason you have to use Get_Immediate to read the
first character, you can store that character in a string, use
Get_Line to read the rest of the string, use one of several methods
(concatenation and slices come to mind) to put the first character
together with the rest of the string, then use Integer'Value to
convert the string as a whole.

Unless I'm misunderstanding the task you're trying to accomplish, I
don't see any reason why you would have to deal with converting a
single character to an integer.

-- Adam
.



Relevant Pages

  • Re: Data String Manipulation
    ... Function MakeString(Scan As String) As String ... Dim Ret As String ... GoTo Exit_Func ... always need to delete the first character in the scanned string, ...
    (microsoft.public.access.modulesdaovba)
  • Re: LPCWSTR to CString conversion problem
    ... I get the first character of the string and pass it to ... LPCWSTR to CString conversion. ... Do you compile as Unicode or Ansi? ... GetAtreturns the second character of the string, ...
    (microsoft.public.vc.atl)
  • RE: Help required to read and print lines based on the type of first character
    ... Please, don't top-post, and learn to quote & snip ... elif '##' in data: ... Read doc for the strip method of string ... the specification is that it should seek for the first character and based on that it should take the decision. ...
    (comp.lang.python)
  • Re: Capitalizing the first letter
    ... Education Technology Department Ankara / TURKEY ... In PHP ucfirstfunction make a string's first character uppercase. ... But ralph smith have two words respectivetely ralph and smith. ... string, ...
    (php.general)
  • Re: Capitalizing the first letter
    ... Education Technology Department Ankara / TURKEY ... In PHP ucfirstfunction make a string's first character uppercase. ... But ralph smith have two words respectivetely ralph and smith. ... string, ...
    (php.general)