Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Space
Message
De
21/05/2003 06:08:05
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Re: Space
Divers
Thread ID:
00790954
Message ID:
00790965
Vues:
17
This message has been marked as the solution to the initial question of the thread.
>I have a table with over 1,000 records with the field description
>on the format below
>
>BM146
>SLV640HF
>SLV660HF
>SLV676
>SLV676UC
>SLV686HF
>SLV696HF
>SLV696UC
>
>I would like to space between numbers and letters
>
>BM 146
>SLV 640 HF
>SLV 660 HF
>SLV 676
>SLV 676 UC
>SLV 686 HF
>SLV 696 HF
>SLV 696 UC
>
>Note that it's hard because some has three letter as prefix
>and other have two letters. Other has sufix and not
>
>TIA
>
>Moises
Function PutSpaces
Lparameters tcStr
local lcNumber
lcNumber = Chrtran(tcStr,Chrtran(tcStr,'0123456789',''),'')
return Stuff(tcStr, At(lcNumber, tcStr), Len(lcNumber), ' '+lcNumber+' ')
Or a oneliner to use in a replace (with 1000 recs only no need to check for performance IMHO).ie :
replace all myfield with ;
  Stuff(myField, ;
  At(Chrtran(myField,Chrtran(myField,'0123456789',''),''), myField), ;
  Len(Chrtran(myField,Chrtran(myField,'0123456789',''),'')), ;
  ' '+Chrtran(myField,Chrtran(myField,'0123456789',''),'')+' ')
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform