Using xstring utilities on \ref*{…}

In the following code, I would like to use \StrGobbleLeft{\ref*{#1}}{2} so as to use n instead #n where the last formatting is used to number special footnotes for links.

\StrGobbleLeft{\ref*{#1}}{2} doesn't work. Is there a way to achieve what I want to do ?

What I want concretly...

I want to use footnote whiche have numbering displaying using #n where n is one usual counter for footnotes and the hash symbol # is used to indicate very special footnotes. I use this for links in text, instead of displaying http://www.google.fr/, in the text my macro newUrl prints something like http://link-n/#n where n is a counter for new URLS, and #n is one footonote, the content of this footnote is the complete link.

I have one secund macro oldUrl usefull to reuse one link already indicated without creating one new footnote. I've trouble with this secund macro where I want to use \ref*{...} so as to have the text of the footnote number attached to one label in the text of one footnote associated to one new URL.

My code

% Sources :
%   * http://tex.stackexchange.com/questions/35095/special-footnotes-for-url/35097#35097
%   * http://tex.stackexchange.com/questions/35043/how-to-reference-different-places-to-the-same-footnote
%   * http://tex.stackexchange.com/questions/35105/test-equality-between-number-of-the-current-page-and-the-one-of-one-reference-in

\documentclass[10pt]{article}
\usepackage[svgnames]{xcolor}
\usepackage{manyfoot}
\usepackage{xifthen}
\usepackage{hyperref}
\usepackage{varioref}
\usepackage{xstring}

% Breakable texttt
%
% Sources :
%   * http://forum.mathematex.net/latex-f6/forcer-le-retour-a-la-ligne-dans-texttt-t13246.html#p127511
%   * http://tex.stackexchange.com/questions/33465/changing-the-catcode-of-in-one-command
%   * http://tex.stackexchange.com/questions/33564/how-listing-and-verbatim-do-to-escape-special-character
\makeatletter
\newcommand\breakabletexttt{%
\begingroup
\catcode\_=12 \catcode\#=12 % To be completed...
\@breakabletexttt
}
\newcommand\@breakabletexttt[1]{%
\ttfamily
\breakable@texttt#1\@nil%
\endgroup%
}
\def\@gobble@fi#1\fi{\fi#1}
\def\breakable@texttt#1#2\@nil{%
#1\hspace{0pt plus 0.1pt minus 0.1pt}%
\ifx\relax#2\relax
\else
\@gobble@fi\breakable@texttt#2\@nil
\fi
}
\makeatother

% Cosmetic
\hypersetup{urlcolor=blue}
\definecolor{urlColor}{named}{DarkRed}

\newcommand{\urlText}[2][0]{%
\textcolor{urlColor}{%
\ifthenelse{\equal{#1}{0}}{%
\textbf{\breakabletexttt{#2}}%
}{%
\ifthenelse{\equal{#1}{2}}{%
\textbf{\texttt{#2}}%
}{%
\emph{#2}%
}%
}%
}%
}

% Special footnote
\newfootnote{Url}

\newcounter{footnoteUrl}
\newcommand{\footnoteUrl}{%
%      \renewcommand\thefootnoteUrl{\Alph{footnoteUrl}}
\stepcounter{footnoteUrl}%
\Footnotemark{\urlText[2]{\#\thefootnoteUrl}}\FootnotetextUrl{}%
}

% New url
\newcounter{UrlCounter}
\newcommand{\newUrl}[2][0]{%
\stepcounter{UrlCounter}%
\ifthenelse{\equal{#1}{0}}{%
\footnoteUrl{\, \url{#2}}%
}{%
\footnoteUrl{\,\label{#1} \url{#2}}%
}%
}

%%%%%%%%%%%%%%%%%%%%%%%%%
% MY PROBLEM IS HERE... %
%%%%%%%%%%%%%%%%%%%%%%%%%

% Old url
\newcommand{\oldUrl}[1]{%
\vrefpagenum{\urlpage}{#1}%
\urlText{http://link-{\StrGobbleLeft{\#?}{1}}/}% To see what I want to do...
\urlText[2]{\textsuperscript{\ref{#1}}}%
\ifthenelse{\equal{\urlpage}{\thepage}}{}{%
\urlText[1]{ (see\vpageref{#1})}%
}%
}

\usepackage{lipsum}

\begin{document}

and another \newUrl{http://tex.stackexchange.com/}.
and one more \newUrl{http://tug.org/texlive/pkginstall.html}
and another \newUrl[ctan]{http://www.ctan.org/}
and then the same \oldUrl{ctan}.
I would like to indicate something \footnote{... but here !}.

\lipsum

I would like to indicate something \footnote{... but here !}.

\lipsum

I would like to indicate something \footnote{... but here !}.

\end{document}

-
Using # in this context breaks many mechanisms of hyperref. Please, state in a clearer way the results you wish to obtain, as the example doesn't compile. –  egreg Nov 17 '11 at 11:59
Indeed, the first compilation insults me but the secund one works fine... The problem doesn't seem to come from the use of the hash symbol #. I don't know why the first compilation complains... –  projetmbc Nov 17 '11 at 14:31
It compiles the second time, but it's not clear what you want. –  egreg Nov 17 '11 at 15:17
I've tried to be clearer... I try my best bt my english is a poor one. –  projetmbc Nov 17 '11 at 15:54

Not really understood what you exactly want! I hope this code helps:

\documentclass[10pt]{article}
\usepackage[svgnames]{xcolor}
\usepackage{manyfoot}
\usepackage{hyperref}
\usepackage{varioref}

\makeatletter
\newcommand\breakabletexttt{%
\begingroup
\@makeother\_\@makeother\#%
\breakabletexttt@i
}

\newcommand\breakabletexttt@i[1]{%
\ttfamily
\breakabletexttt@ii#1\breakabletexttt@ii
\endgroup
}

\newcommand\breakabletexttt@ii[1]{%
\unless\ifx\breakabletexttt@ii#1%
#1\hspace{0pt plus 0.1pt minus 0.1pt}\expandafter\breakabletexttt@ii
\fi
}

\newcommand\textbftt[1]{\textbf{\texttt{#1}}}
\newcommand\breakttbf[1]{\textbf{\breakabletexttt{#1}}}
\hypersetup{urlcolor=blue}
\definecolor{urlColor}{named}{DarkRed}

\newcommand\urlText[2][\breakttbf]{\textcolor{urlColor}{#1{#2}}}

\newfootnote{Url}

\newcount\cnt@footurl
\newcommand\footnoteUrl{%
\Footnotemark{\urlText[\emph]{\#\number\cnt@footurl}}\FootnotetextUrl{}%
}

\newcount\cnt@url
\newcommand\newUrl[2][]{%
\expandafter\expandafter\expandafter\urlText\expandafter\expandafter\expandafter{\csname url@@#1\endcsname/}%
\footnoteUrl{\,\ifx\@empty#1\@empty\else\label{#1}\fi{} \url{#2}}%
}

\newcommand\oldUrl[1]{%
\vrefpagenum{\urlpage}{#1}%
\expandafter\expandafter\expandafter\urlText\expandafter\expandafter\expandafter{\csname url@@#1\endcsname/}%
\unless\ifnum\urlpage=\thepage\relax\urlText[\textbftt]{ (see\vpageref{#1})}\fi
}

\makeatother
\begin{document}

and another \newUrl{http://tex.stackexchange.com/}.
and one more \newUrl{http://tug.org/texlive/pkginstall.html}
and another \newUrl[ctan]{http://www.ctan.org/}
and then the same \oldUrl{ctan}.
I would like to indicate something \footnote{... but here !}.
\bigbreak