Re: Text Functions

From: Kirk P. (KirkP_at_discussions.microsoft.com)
Date: 03/02/05


Date: Wed, 2 Mar 2005 13:15:36 -0800

The function runs, but returns the same text string that I started with. I
have determined that the space is ALWAYS the first character. I would think
the Trim or LTrim function would remove it, but it does not.

Any other ideas? There is definately a space before the first character.

"MGFoster" wrote:

> Kirk P. wrote:
> > Is there a function to remove spaces within a text field?
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> There isn't a built-in one. Try this:
>
> Function NoSpaces(ByVal s As String) As String
>
> Const WHITESPACE = " "
>
> s = Trim$(s)
>
> Dim p As Long
> p = InStr(s, WHITESPACE)
> Do While p > 0
> s = Left$(s, p - 1) & Mid$(s, p + 1)
> p = InStr(p, s, WHITESPACE)
> Loop
>
> NoSpaces = s
>
> End Function
>
>
>
> --
> MGFoster:::mgf00 <at> earthlink <decimal-point> net
> Oakland, CA (USA)
>
> -----BEGIN PGP SIGNATURE-----
> Version: PGP for Personal Privacy 5.0
> Charset: noconv
>
> iQA/AwUBQiYmQYechKqOuFEgEQK2fwCgom0kccXof542/iDl4WUxG1inl/gAoNFz
> zok80z7tPp2+Ero3V5l3Dr4r
> =IxoP
> -----END PGP SIGNATURE-----
>



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: Converting Type Characters to type string
    ... used to determine whether or not the input was a integer roman numeral ... advice and are using Get_Line to read an entire string first, ... look at the first character of the string to see whether it's Q or a ... can still convert the entire input string using Integer'Value. ...
    (comp.lang.ada)
  • 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)