How to extract the currency symbol?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
4
down vote

favorite












Within the Datatool package, we find the currency data type.



A currency data type is a currency symbol followed by an integer or real number.



How can I extract the currency symbol out of a currency data ??



documentclassarticle

usepackagedatatool

newcommandsplitCurrency[1]%
noindent Splitting #1 into its value and symbol parts:
DTLifcurrency#1% Check: Is #1 currency?
% Check: #1 is currency !
\The value: DTLconverttodecimal#1theValue theValue%
\The symbol: ??
% Check: #1 is not currency !
Not a currency !
%


begindocument

splitCurrency$ 123%

enddocument






share|improve this question
























    up vote
    4
    down vote

    favorite












    Within the Datatool package, we find the currency data type.



    A currency data type is a currency symbol followed by an integer or real number.



    How can I extract the currency symbol out of a currency data ??



    documentclassarticle

    usepackagedatatool

    newcommandsplitCurrency[1]%
    noindent Splitting #1 into its value and symbol parts:
    DTLifcurrency#1% Check: Is #1 currency?
    % Check: #1 is currency !
    \The value: DTLconverttodecimal#1theValue theValue%
    \The symbol: ??
    % Check: #1 is not currency !
    Not a currency !
    %


    begindocument

    splitCurrency$ 123%

    enddocument






    share|improve this question






















      up vote
      4
      down vote

      favorite









      up vote
      4
      down vote

      favorite











      Within the Datatool package, we find the currency data type.



      A currency data type is a currency symbol followed by an integer or real number.



      How can I extract the currency symbol out of a currency data ??



      documentclassarticle

      usepackagedatatool

      newcommandsplitCurrency[1]%
      noindent Splitting #1 into its value and symbol parts:
      DTLifcurrency#1% Check: Is #1 currency?
      % Check: #1 is currency !
      \The value: DTLconverttodecimal#1theValue theValue%
      \The symbol: ??
      % Check: #1 is not currency !
      Not a currency !
      %


      begindocument

      splitCurrency$ 123%

      enddocument






      share|improve this question












      Within the Datatool package, we find the currency data type.



      A currency data type is a currency symbol followed by an integer or real number.



      How can I extract the currency symbol out of a currency data ??



      documentclassarticle

      usepackagedatatool

      newcommandsplitCurrency[1]%
      noindent Splitting #1 into its value and symbol parts:
      DTLifcurrency#1% Check: Is #1 currency?
      % Check: #1 is currency !
      \The value: DTLconverttodecimal#1theValue theValue%
      \The symbol: ??
      % Check: #1 is not currency !
      Not a currency !
      %


      begindocument

      splitCurrency$ 123%

      enddocument








      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 16 at 8:58









      Joseph Marie

      1436




      1436




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          5
          down vote



          accepted










          After running DTLifcurrency or the internal equivalent @dtl@checknumerical, the currency symbol is stored in @dtl@currency, so you can use



          documentclassarticle

          usepackagedatatool

          makeatletter
          newcommandgetcurrencysymbol[2]%
          @dtl@checknumerical#1%
          ifnum@dtl@datatype=3relaxlet#2@dtl@currencyelsedef#2??fi

          makeatother
          newcommandsplitCurrency[1]%
          noindent Splitting #1 into its value and symbol parts:
          DTLifcurrency#1% Check: Is #1 currency?
          % Check: #1 is currency !
          \The value: DTLconverttodecimal#1theValuetheValue%
          \The symbol: getcurrencysymbol#1theCurrencytheCurrency
          % Check: #1 is not currency !
          Not a currency !
          %


          begindocument

          splitCurrency$ 123%

          enddocument


          enter image description here






          share|improve this answer




















          • Anyway to force the extension within getcurrencysymbol, so that I don't have to repeat expandaftertheCurrencyrelax on each use?
            – Joseph Marie
            Aug 16 at 10:52










          • @JosephMarie I do not understand your question. Why would you have to repeat expandaftertheCurrencyrelax? expandaftertheCurrencyrelax would try to expand the non-expandable relax, so expandafter is useless here.
            – Marcel Krüger
            Aug 16 at 11:05










          • When I run getcurrencysymbol$ 123symbol% DTLnewdbentrydataSymbolsymbol%, I get an Error (Extra else....). When I do DTLnewdbentrydataSymbolexpandaftersymbolrelax%, there is no error.
            – Joseph Marie
            Aug 16 at 12:18






          • 2




            @JosephMarie that's imho a bug in datatool, it fails if the value starts with something that could be a currency. Your expandafter command hides this. You could also use relaxsymbol. I wrote Nicola a mail.
            – Ulrike Fischer
            Aug 16 at 14:28

















          up vote
          5
          down vote













          documentclassarticle
          usepackagedatatool
          DTLnewcurrencysymbol€

          defsplitCurrency#1noindent Splitting #1 into its value and symbol parts:
          splitCurrencyA#1;
          defsplitCurrencyA#1#2;%
          DTLifcurrency#1#2% Check: Is #1 currency?
          % Check: #1 is currency !
          \The value: DTLconverttodecimal#2theValue theValue%
          \The symbol: #1
          % Check: #1 is not currency !
          Not a currency !
          %


          begindocument
          splitCurrency$123%

          splitCurrency€123%
          enddocument


          enter image description here






          share|improve this answer




















          • Very elegant solution! How does the argument parsing system knowns that he has to split into "text-value" at defsplitCurrencyA#1#2; ?
            – Joseph Marie
            Aug 16 at 10:15










          • The currency symbol is only one character or a macro (#1) and the rest until the ; will be the value (#2), that‘s all.
            – Herbert
            Aug 16 at 11:36










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "85"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f446257%2fhow-to-extract-the-currency-symbol%23new-answer', 'question_page');

          );

          Post as a guest






























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          5
          down vote



          accepted










          After running DTLifcurrency or the internal equivalent @dtl@checknumerical, the currency symbol is stored in @dtl@currency, so you can use



          documentclassarticle

          usepackagedatatool

          makeatletter
          newcommandgetcurrencysymbol[2]%
          @dtl@checknumerical#1%
          ifnum@dtl@datatype=3relaxlet#2@dtl@currencyelsedef#2??fi

          makeatother
          newcommandsplitCurrency[1]%
          noindent Splitting #1 into its value and symbol parts:
          DTLifcurrency#1% Check: Is #1 currency?
          % Check: #1 is currency !
          \The value: DTLconverttodecimal#1theValuetheValue%
          \The symbol: getcurrencysymbol#1theCurrencytheCurrency
          % Check: #1 is not currency !
          Not a currency !
          %


          begindocument

          splitCurrency$ 123%

          enddocument


          enter image description here






          share|improve this answer




















          • Anyway to force the extension within getcurrencysymbol, so that I don't have to repeat expandaftertheCurrencyrelax on each use?
            – Joseph Marie
            Aug 16 at 10:52










          • @JosephMarie I do not understand your question. Why would you have to repeat expandaftertheCurrencyrelax? expandaftertheCurrencyrelax would try to expand the non-expandable relax, so expandafter is useless here.
            – Marcel Krüger
            Aug 16 at 11:05










          • When I run getcurrencysymbol$ 123symbol% DTLnewdbentrydataSymbolsymbol%, I get an Error (Extra else....). When I do DTLnewdbentrydataSymbolexpandaftersymbolrelax%, there is no error.
            – Joseph Marie
            Aug 16 at 12:18






          • 2




            @JosephMarie that's imho a bug in datatool, it fails if the value starts with something that could be a currency. Your expandafter command hides this. You could also use relaxsymbol. I wrote Nicola a mail.
            – Ulrike Fischer
            Aug 16 at 14:28














          up vote
          5
          down vote



          accepted










          After running DTLifcurrency or the internal equivalent @dtl@checknumerical, the currency symbol is stored in @dtl@currency, so you can use



          documentclassarticle

          usepackagedatatool

          makeatletter
          newcommandgetcurrencysymbol[2]%
          @dtl@checknumerical#1%
          ifnum@dtl@datatype=3relaxlet#2@dtl@currencyelsedef#2??fi

          makeatother
          newcommandsplitCurrency[1]%
          noindent Splitting #1 into its value and symbol parts:
          DTLifcurrency#1% Check: Is #1 currency?
          % Check: #1 is currency !
          \The value: DTLconverttodecimal#1theValuetheValue%
          \The symbol: getcurrencysymbol#1theCurrencytheCurrency
          % Check: #1 is not currency !
          Not a currency !
          %


          begindocument

          splitCurrency$ 123%

          enddocument


          enter image description here






          share|improve this answer




















          • Anyway to force the extension within getcurrencysymbol, so that I don't have to repeat expandaftertheCurrencyrelax on each use?
            – Joseph Marie
            Aug 16 at 10:52










          • @JosephMarie I do not understand your question. Why would you have to repeat expandaftertheCurrencyrelax? expandaftertheCurrencyrelax would try to expand the non-expandable relax, so expandafter is useless here.
            – Marcel Krüger
            Aug 16 at 11:05










          • When I run getcurrencysymbol$ 123symbol% DTLnewdbentrydataSymbolsymbol%, I get an Error (Extra else....). When I do DTLnewdbentrydataSymbolexpandaftersymbolrelax%, there is no error.
            – Joseph Marie
            Aug 16 at 12:18






          • 2




            @JosephMarie that's imho a bug in datatool, it fails if the value starts with something that could be a currency. Your expandafter command hides this. You could also use relaxsymbol. I wrote Nicola a mail.
            – Ulrike Fischer
            Aug 16 at 14:28












          up vote
          5
          down vote



          accepted







          up vote
          5
          down vote



          accepted






          After running DTLifcurrency or the internal equivalent @dtl@checknumerical, the currency symbol is stored in @dtl@currency, so you can use



          documentclassarticle

          usepackagedatatool

          makeatletter
          newcommandgetcurrencysymbol[2]%
          @dtl@checknumerical#1%
          ifnum@dtl@datatype=3relaxlet#2@dtl@currencyelsedef#2??fi

          makeatother
          newcommandsplitCurrency[1]%
          noindent Splitting #1 into its value and symbol parts:
          DTLifcurrency#1% Check: Is #1 currency?
          % Check: #1 is currency !
          \The value: DTLconverttodecimal#1theValuetheValue%
          \The symbol: getcurrencysymbol#1theCurrencytheCurrency
          % Check: #1 is not currency !
          Not a currency !
          %


          begindocument

          splitCurrency$ 123%

          enddocument


          enter image description here






          share|improve this answer












          After running DTLifcurrency or the internal equivalent @dtl@checknumerical, the currency symbol is stored in @dtl@currency, so you can use



          documentclassarticle

          usepackagedatatool

          makeatletter
          newcommandgetcurrencysymbol[2]%
          @dtl@checknumerical#1%
          ifnum@dtl@datatype=3relaxlet#2@dtl@currencyelsedef#2??fi

          makeatother
          newcommandsplitCurrency[1]%
          noindent Splitting #1 into its value and symbol parts:
          DTLifcurrency#1% Check: Is #1 currency?
          % Check: #1 is currency !
          \The value: DTLconverttodecimal#1theValuetheValue%
          \The symbol: getcurrencysymbol#1theCurrencytheCurrency
          % Check: #1 is not currency !
          Not a currency !
          %


          begindocument

          splitCurrency$ 123%

          enddocument


          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 16 at 9:34









          Marcel Krüger

          9,9211930




          9,9211930











          • Anyway to force the extension within getcurrencysymbol, so that I don't have to repeat expandaftertheCurrencyrelax on each use?
            – Joseph Marie
            Aug 16 at 10:52










          • @JosephMarie I do not understand your question. Why would you have to repeat expandaftertheCurrencyrelax? expandaftertheCurrencyrelax would try to expand the non-expandable relax, so expandafter is useless here.
            – Marcel Krüger
            Aug 16 at 11:05










          • When I run getcurrencysymbol$ 123symbol% DTLnewdbentrydataSymbolsymbol%, I get an Error (Extra else....). When I do DTLnewdbentrydataSymbolexpandaftersymbolrelax%, there is no error.
            – Joseph Marie
            Aug 16 at 12:18






          • 2




            @JosephMarie that's imho a bug in datatool, it fails if the value starts with something that could be a currency. Your expandafter command hides this. You could also use relaxsymbol. I wrote Nicola a mail.
            – Ulrike Fischer
            Aug 16 at 14:28
















          • Anyway to force the extension within getcurrencysymbol, so that I don't have to repeat expandaftertheCurrencyrelax on each use?
            – Joseph Marie
            Aug 16 at 10:52










          • @JosephMarie I do not understand your question. Why would you have to repeat expandaftertheCurrencyrelax? expandaftertheCurrencyrelax would try to expand the non-expandable relax, so expandafter is useless here.
            – Marcel Krüger
            Aug 16 at 11:05










          • When I run getcurrencysymbol$ 123symbol% DTLnewdbentrydataSymbolsymbol%, I get an Error (Extra else....). When I do DTLnewdbentrydataSymbolexpandaftersymbolrelax%, there is no error.
            – Joseph Marie
            Aug 16 at 12:18






          • 2




            @JosephMarie that's imho a bug in datatool, it fails if the value starts with something that could be a currency. Your expandafter command hides this. You could also use relaxsymbol. I wrote Nicola a mail.
            – Ulrike Fischer
            Aug 16 at 14:28















          Anyway to force the extension within getcurrencysymbol, so that I don't have to repeat expandaftertheCurrencyrelax on each use?
          – Joseph Marie
          Aug 16 at 10:52




          Anyway to force the extension within getcurrencysymbol, so that I don't have to repeat expandaftertheCurrencyrelax on each use?
          – Joseph Marie
          Aug 16 at 10:52












          @JosephMarie I do not understand your question. Why would you have to repeat expandaftertheCurrencyrelax? expandaftertheCurrencyrelax would try to expand the non-expandable relax, so expandafter is useless here.
          – Marcel Krüger
          Aug 16 at 11:05




          @JosephMarie I do not understand your question. Why would you have to repeat expandaftertheCurrencyrelax? expandaftertheCurrencyrelax would try to expand the non-expandable relax, so expandafter is useless here.
          – Marcel Krüger
          Aug 16 at 11:05












          When I run getcurrencysymbol$ 123symbol% DTLnewdbentrydataSymbolsymbol%, I get an Error (Extra else....). When I do DTLnewdbentrydataSymbolexpandaftersymbolrelax%, there is no error.
          – Joseph Marie
          Aug 16 at 12:18




          When I run getcurrencysymbol$ 123symbol% DTLnewdbentrydataSymbolsymbol%, I get an Error (Extra else....). When I do DTLnewdbentrydataSymbolexpandaftersymbolrelax%, there is no error.
          – Joseph Marie
          Aug 16 at 12:18




          2




          2




          @JosephMarie that's imho a bug in datatool, it fails if the value starts with something that could be a currency. Your expandafter command hides this. You could also use relaxsymbol. I wrote Nicola a mail.
          – Ulrike Fischer
          Aug 16 at 14:28




          @JosephMarie that's imho a bug in datatool, it fails if the value starts with something that could be a currency. Your expandafter command hides this. You could also use relaxsymbol. I wrote Nicola a mail.
          – Ulrike Fischer
          Aug 16 at 14:28










          up vote
          5
          down vote













          documentclassarticle
          usepackagedatatool
          DTLnewcurrencysymbol€

          defsplitCurrency#1noindent Splitting #1 into its value and symbol parts:
          splitCurrencyA#1;
          defsplitCurrencyA#1#2;%
          DTLifcurrency#1#2% Check: Is #1 currency?
          % Check: #1 is currency !
          \The value: DTLconverttodecimal#2theValue theValue%
          \The symbol: #1
          % Check: #1 is not currency !
          Not a currency !
          %


          begindocument
          splitCurrency$123%

          splitCurrency€123%
          enddocument


          enter image description here






          share|improve this answer




















          • Very elegant solution! How does the argument parsing system knowns that he has to split into "text-value" at defsplitCurrencyA#1#2; ?
            – Joseph Marie
            Aug 16 at 10:15










          • The currency symbol is only one character or a macro (#1) and the rest until the ; will be the value (#2), that‘s all.
            – Herbert
            Aug 16 at 11:36














          up vote
          5
          down vote













          documentclassarticle
          usepackagedatatool
          DTLnewcurrencysymbol€

          defsplitCurrency#1noindent Splitting #1 into its value and symbol parts:
          splitCurrencyA#1;
          defsplitCurrencyA#1#2;%
          DTLifcurrency#1#2% Check: Is #1 currency?
          % Check: #1 is currency !
          \The value: DTLconverttodecimal#2theValue theValue%
          \The symbol: #1
          % Check: #1 is not currency !
          Not a currency !
          %


          begindocument
          splitCurrency$123%

          splitCurrency€123%
          enddocument


          enter image description here






          share|improve this answer




















          • Very elegant solution! How does the argument parsing system knowns that he has to split into "text-value" at defsplitCurrencyA#1#2; ?
            – Joseph Marie
            Aug 16 at 10:15










          • The currency symbol is only one character or a macro (#1) and the rest until the ; will be the value (#2), that‘s all.
            – Herbert
            Aug 16 at 11:36












          up vote
          5
          down vote










          up vote
          5
          down vote









          documentclassarticle
          usepackagedatatool
          DTLnewcurrencysymbol€

          defsplitCurrency#1noindent Splitting #1 into its value and symbol parts:
          splitCurrencyA#1;
          defsplitCurrencyA#1#2;%
          DTLifcurrency#1#2% Check: Is #1 currency?
          % Check: #1 is currency !
          \The value: DTLconverttodecimal#2theValue theValue%
          \The symbol: #1
          % Check: #1 is not currency !
          Not a currency !
          %


          begindocument
          splitCurrency$123%

          splitCurrency€123%
          enddocument


          enter image description here






          share|improve this answer












          documentclassarticle
          usepackagedatatool
          DTLnewcurrencysymbol€

          defsplitCurrency#1noindent Splitting #1 into its value and symbol parts:
          splitCurrencyA#1;
          defsplitCurrencyA#1#2;%
          DTLifcurrency#1#2% Check: Is #1 currency?
          % Check: #1 is currency !
          \The value: DTLconverttodecimal#2theValue theValue%
          \The symbol: #1
          % Check: #1 is not currency !
          Not a currency !
          %


          begindocument
          splitCurrency$123%

          splitCurrency€123%
          enddocument


          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 16 at 9:32









          Herbert

          260k21394702




          260k21394702











          • Very elegant solution! How does the argument parsing system knowns that he has to split into "text-value" at defsplitCurrencyA#1#2; ?
            – Joseph Marie
            Aug 16 at 10:15










          • The currency symbol is only one character or a macro (#1) and the rest until the ; will be the value (#2), that‘s all.
            – Herbert
            Aug 16 at 11:36
















          • Very elegant solution! How does the argument parsing system knowns that he has to split into "text-value" at defsplitCurrencyA#1#2; ?
            – Joseph Marie
            Aug 16 at 10:15










          • The currency symbol is only one character or a macro (#1) and the rest until the ; will be the value (#2), that‘s all.
            – Herbert
            Aug 16 at 11:36















          Very elegant solution! How does the argument parsing system knowns that he has to split into "text-value" at defsplitCurrencyA#1#2; ?
          – Joseph Marie
          Aug 16 at 10:15




          Very elegant solution! How does the argument parsing system knowns that he has to split into "text-value" at defsplitCurrencyA#1#2; ?
          – Joseph Marie
          Aug 16 at 10:15












          The currency symbol is only one character or a macro (#1) and the rest until the ; will be the value (#2), that‘s all.
          – Herbert
          Aug 16 at 11:36




          The currency symbol is only one character or a macro (#1) and the rest until the ; will be the value (#2), that‘s all.
          – Herbert
          Aug 16 at 11:36












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f446257%2fhow-to-extract-the-currency-symbol%23new-answer', 'question_page');

          );

          Post as a guest













































































          這個網誌中的熱門文章

          Is there any way to eliminate the singular point to solve this integral by hand or by approximations?

          Why am i infinitely getting the same tweet with the Twitter Search API?

          Carbon dioxide