# How to create a string comparison with xparse's \NewDocumentCommand?

My MWE was created with the help of these two Q&As: 1 and 2.

# MWE:

\documentclass{article}
\usepackage{xparse}
\usepackage{xstring}
\usepackage{pdftexcmds}

% Command declaring a global definition if argument not empty, and using a pre-defined empty definition if argument empty
\ExplSyntaxOn%
\NewDocumentCommand{\Client}{g}%
{%
\IfNoValueTF{#1}%
{%
\tl_use:N \g_jalep_client_tl%
}%
{%
\tl_gset:Nn \g_jalep_client_tl {#1}%
}%
}%
\tl_new:N \g_jalep_client_tl%
\ExplSyntaxOff%

% Attempt using \pdfstrcmp
\makeatletter
\newcommand\foo[1]{%
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi
{Eve}%
}
\makeatother

\begin{document}
% Attempt using xstring
% Attempt using \pdfstrcmp
\par My client should be Adam: \foo{\Client}
\end{document}


# Notes:

2. From this, I'm inclined to believe \Client produces something other than a string? How do I change this/convert this/work with this when I'm trying to create an if-else statement?

# Question:

How do I make a string comparison with the \NewDocumentCommand shown in my MWE? Something like: If \Client = Adam, then print: Adam, else print: Eve

• Are you open to alterations to the definition of \Client? – Werner Jan 16 '19 at 1:01
• @Werner Yes, though in my document: 1. \Client is always called either empty like this: \Client{} or with any argument like this: \Client{Argument}. 2. \Client{} or \Client{Argument} should print nothing, and only the command \Client should print whatever the global definition defined with \Client is – jed Jan 16 '19 at 2:05
• So, a first call to \Client{<name>} destroys its and just stores the <name>. – Werner Jan 16 '19 at 2:35
• @Werner Yes! Correct – jed Jan 16 '19 at 2:46

The following doesn't use LaTeX3, but works the way you want it, both using xstring and \pdfstrcmp:

\documentclass{article}

\usepackage{xstring}


\makeatletter
\newcommand\foo[1]{%
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi
{Eve}%
}
\makeatother

\begin{document}