Quote from
Palamar on October 7, 2024, 3:05 pm
Buenas, he realizado una pequeña rutina para poner comas o puntos (lo que prefieran) a un número de manera dinámica. Solo colocan un TextEntry con la variable [N1] y en las acciones de cambio de texto colocan esta rutina:
StrLen "[N1]" "[NL]"
SearchStr "," "[N1]" "[NLComa]" ""
IfEx "[NL]=4 AND [NLComa]=0"
StrReplace "[N1]" "," "" "[N1]" ""
StrIns "," "[N1]" "2" "[N1]"
endif
IfEx "[NL]=4 AND [NLComa]<>0"
StrReplace "[N1]" "," "" "[N1]" ""
endif
IfEx "[NL]=5 AND [NLComa]<>0"
StrReplace "[N1]" "," "" "[N1]" ""
StrIns "," "[N1]" "2" "[N1]"
endif
If "[NL]" "=" "6"
StrReplace "[N1]" "," "" "[N1]" ""
StrIns "," "[N1]" "3" "[N1]"
endif
If "[NL]" "=" "7"
StrReplace "[N1]" "," "" "[N1]" ""
StrIns "," "[N1]" "4" "[N1]"
endif
La rutina formatea hasta números de 6 cifras.
Espero les sea útil!.
Buenas, he realizado una pequeña rutina para poner comas o puntos (lo que prefieran) a un número de manera dinámica. Solo colocan un TextEntry con la variable [N1] y en las acciones de cambio de texto colocan esta rutina:
StrLen "[N1]" "[NL]"
SearchStr "," "[N1]" "[NLComa]" ""
IfEx "[NL]=4 AND [NLComa]=0"
StrReplace "[N1]" "," "" "[N1]" ""
StrIns "," "[N1]" "2" "[N1]"
endif
IfEx "[NL]=4 AND [NLComa]<>0"
StrReplace "[N1]" "," "" "[N1]" ""
endif
IfEx "[NL]=5 AND [NLComa]<>0"
StrReplace "[N1]" "," "" "[N1]" ""
StrIns "," "[N1]" "2" "[N1]"
endif
If "[NL]" "=" "6"
StrReplace "[N1]" "," "" "[N1]" ""
StrIns "," "[N1]" "3" "[N1]"
endif
If "[NL]" "=" "7"
StrReplace "[N1]" "," "" "[N1]" ""
StrIns "," "[N1]" "4" "[N1]"
endif
La rutina formatea hasta números de 6 cifras.
Espero les sea útil!.
luishp and alangonzalez91 have reacted to this post.