From 8539f98d104566855fb6227437f076e140e175d0 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 16 Jun 2008 14:47:19 +0000 Subject: [PATCH] =?UTF-8?q?A=C3=B1adida=20funci=C3=B3n=20uStringsUtils.pas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://192.168.0.254/svn/Proyectos.LuisLeon_FactuGES/trunk@246 c93665c3-c93d-084d-9b98-7d5f4a9c3376 --- Source/Base/Base.dpk | 3 +- Source/Base/Base.res | Bin 384 -> 4748 bytes Source/Base/Utiles/uStringsUtils.pas | 71 +++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 Source/Base/Utiles/uStringsUtils.pas diff --git a/Source/Base/Base.dpk b/Source/Base/Base.dpk index 71f683e7..c1c4d680 100644 --- a/Source/Base/Base.dpk +++ b/Source/Base/Base.dpk @@ -100,6 +100,7 @@ contains MD5 in 'Utiles\MD5.pas', uPasswordUtils in 'Utiles\uPasswordUtils.pas', uInfoProjectUtils in 'Utiles\uInfoProjectUtils.pas', - uInformeRegistryUtils in 'ClassRegistry\uInformeRegistryUtils.pas'; + uInformeRegistryUtils in 'ClassRegistry\uInformeRegistryUtils.pas', + uStringsUtils in 'Utiles\uStringsUtils.pas'; end. diff --git a/Source/Base/Base.res b/Source/Base/Base.res index 8b251f312bcccec5485024f6fe8d80e1cdf25746..1641339fcc482e7e3492d1b45813a86619622c33 100644 GIT binary patch literal 4748 zcmbW5&ub)A5XUPdpe&2#;C*uNAUVhgd+&(4um@dnom`vXF9g}ZuHJ;se=<3UNdFJg zbCw+UD9j$byGIXV`~6hC>h4S?F|k9X-j90q{Z_qtZ<;nUJCO8!h?p${kR>3GhM`oH*q zk=UsjOCIgA_4!`B+Gb&`I84R)bT4dy-BQV<-SyFz?R8ILEQ(+JB$u{sEXE@j@B*7W zT;iZH#|OJ<&DO$RCkM6VbK3(B(k{nbdv1lpc;E$xz9as|v3uE1V{hw2w~g3eD0an7 z{BT%G%irdMe*|oDJmgvJaA2`9B<6Xi*?M~Q;)@Sbfwf3uf zVaWkbUjU=;sL{BlYemIZXv%qZ{SZw{-TCU+;!nH6KDDIJumU+9{E0zXW4>7T)y|>$DQlv zRJe?TjSp{c!DqeayAnSMTtZZT;>LN7J0Rls+5m@q)MbyB*eL%Eu@(+$Cw}Pd@q7N| z%Q0*AHpCP^b9v`@jx-l_FD>khpW2W8(OU2&V5TrnoAY-m_hlcV?zq3;7{2gF{J#Hc z6R+o~mVenX?>@W0@_DVzyOFs(5464CY{!q9ChoF#_*eXi@4gFuV8?vhl=_w5$iKL0 zEV0nMBcN08xtRmsgJrqjh@s#|{?*ssnsG)mH*wa6{efF0JFWHok@kA5%b661{B38= zCcgJ|*ZFTpV$8<-&+AWpa)Q8*`wL&hMeNQ^v6I7$HSdLZhZ^&+6<@Uw_Zsml9^v3W zVvPDBKHh;i=RU4J_ta3E;)Mn>Y+L zKLZ0UQ+*km9FO-b?U4gmn-62iwzH6&*duKGo~aUV)bYDla8wWZ9+^7p-F<8lP@i!m z@vhbD_${F}h>^T;C(?(b*OJDk?{dEXB?nuehoON3HAb!7Mr7-ls!84-5V-jJugbu<_$}mU=Yd9!?TOX;|B-#B)+0x#9q*yqJiqS!`49d=7ztk$O+9=1i;?K_|J<8T z?0b7=-`Z3A#vV$4XJ5(lQ~TOZHUFdA%oWvK5zg&_IKXIbughQBA8XAsd#=@|TFLXC zy(^m((;DnQmDQKatmw!@c`| G?EMQ&4NnpP delta 11 ScmeBCZD5|Duvteife`=|>;pCc diff --git a/Source/Base/Utiles/uStringsUtils.pas b/Source/Base/Utiles/uStringsUtils.pas new file mode 100644 index 00000000..3180a46a --- /dev/null +++ b/Source/Base/Utiles/uStringsUtils.pas @@ -0,0 +1,71 @@ +unit uStringsUtils; + +interface + +uses + Classes; + +const + DISPLAY_EUROS2 = '#,0.00 €'; + +procedure StringToStrings(Source:string; Delimiter:char; Target:TStrings); +function StringsToString(Source:TStrings; Delimiter:char):string; +function EsCadenaVacia(const S: AnsiString): Boolean; overload; +function EsCadenaVacia(const S: Variant): Boolean; overload; +function EsNumerico(Cadena: String) : Boolean; +function EscaparCadena (Cadena: String): String; + +implementation + +uses + Variants, SysUtils, JclStrings; + +{ Convierte una cadena con items separados con un delimitador en un TString } +procedure StringToStrings(Source:string; Delimiter:char; Target:TStrings); +var i: integer; +begin + for i:=1 to length(Source) do + if Source[ i ] = Delimiter then Source[ i ]:=#10; + Target.Text:=Source; +end; + +{ Convierte un TString en una cadena de items separados con un delimitador } +function StringsToString(Source:TStrings; Delimiter:char):string; +var i: integer; +begin + Result:=''; + for i:=0 to Source.Count-1 do + Result:=Result + Delimiter + Source[ i ]; + if Result<>'' then Delete(Result, 1, 1) +end; + +function EsCadenaVacia(const S: AnsiString): Boolean; +begin + Result := (Length(Trim(S)) = 0) +end; + +function EsCadenaVacia(const S: Variant): Boolean; overload; +begin + Result := True; + if VarIsNull(S) then + Exit; + Result := EsCadenaVacia(VarToStr(S)); +end; + +function EsNumerico(Cadena: String) : Boolean; +var + Codigo: Integer; + Valor: Double; +begin + Val(Cadena, Valor, Codigo); + Result := (Codigo = 0) +end; + +function EscaparCadena (Cadena: String): String; +begin + Result := StringReplace(Cadena, '''', '\\''', []); + Result := StrStringToEscaped(Result); +end; + + +end.