I have written a document with some data that I must update at last minute. So I have created some newcommand:
%--------------------------------
% Insert data here
\newcommand{\srskm}{12,253~}
\newcommand{\srspercent}{1.53\%~}
\newcommand{\srssamples}{2,777,059~}
\newcommand{\srssamplesml}{2.8~}
\newcommand{\srsacc}{833~}
It is all right, but if I omit the tilde, the number will be insert without spacing.
Question: There is a way to declare this data and obtain a spacing when after there is a word, and no spacing when after there is a punctuation?

\xspacewhere you have~from the eponymous package. – yannisl Jun 06 '15 at 09:08Undefined control sequence. Example sentence: \srssampleswhen I call\newcommand{\srssamples}{2777059\xspace}and the others. – Giacomo Alessandroni Jun 06 '15 at 10:02xspacepackage for\xspace– David Carlisle Jun 06 '15 at 10:14