These things are probably difficult if you are “new to LaTeX.” Take your time to learn about tokens, character codes, category codes, expansion, etc. The TeXbook is a good reference to learn about all these.
Explanation of the \if test
The TeX primitive \if recursively expands what follows in the input stream until there are two unexpandable tokens. If these tokens are both character tokens, which is the case in your example as we'll see below, the \if test is true if, and only if the character tokens have the same character code. This may sound non-obvious, but that is how \if works: it compares character codes.
(Other famous tests are \ifcat which compares category codes, \ifnum which compares 〈number〉s, \ifdim which compares 〈dimen〉s, and \ifx which compares the meanings of two tokens.)
In your case, you have \if\tempb\tempa.... After \if has performed one expansion step according to the above description, the front of the input stream is 0.0pt\tempa.... Therefore, your code behaves the same as this:
\if 0.0pt\tempa...
(which is identical to \if0.0pt\tempa... since the first 0 is a non-letter).
So, after this expansion step automatically performed by \if, there are already two unexpandable tokens immediately following in the input stream: 0 and ., both with category code 12 (other), because they come from \edef\tempb{0.0pt}, where the replacement text of \tempb (0.0pt) has been tokenized under the standard category code régime. As a consequence, TeX compares the character codes of 0 and ., which are obviously different (cf. the ASCII code table), therefore the result of the \if test is false—as you observed.
Summary: you wanted to somehow compare \tempb and \tempa, but you actually compared 0 and . from the front of the expansion of \tempb, the rest 0pt\tempa being left at the beginning of the true clause of the \if test, thus ignored here since the test is false (TeX will skip over tokens without expanding anything until it finds a matching \else or \fi).
How to compare lengths and strings
There are many ways to compare lengths and strings in LaTeX. Here are some examples with the ifthen and etoolbox packages. You may also be interested in xifthen and expl3 (well, it may be too early for the latter, but it is very powerful and convenient).
One noteworthy difference between ifthen and etoolbox is that the string equality test \equal from package ifthen recursively expands its arguments but doesn't change the category codes, whereas the \ifstrequal test from package etoolbox doesn't expand its arguments but normalizes the category codes (a priori using \detokenize). This takes great importance because when \test is a 〈dimendef token〉 or a 〈skipdef token〉, which is the case here, \the\test expands to character tokens with category code 12 (other), except for space tokens which are assigned category code 10 (space).1 0.0pt in “all category code 12” is not the same as 0.0pt tokenized with the standard category codes, that is: 12 for 0 and ., 11 (letter) for p and t. That is why comparing \the\test to 0.0pt-tokenized-with-the-standard-catcodes using ifthen's \equal “string” equality test yields false even when \test has been set to 0.0pt. However, if we compare \the\test with \detokenize{0.0pt} using the same \equal comparison function of package ifthen, the result is true when \test has been set to 0.0pt, since \the and \detokenize both assign category codes to the character tokens they expand to in exactly the same way—that is, 12 for every character token except for spaces, which get 10. This way of assigning category codes is what is called “converting to a string” in the expl3 language, by the way.
Here are the examples with the etoolbox package:
\documentclass{article}
\usepackage{etoolbox}
\newlength{\test}
\setlength{\parindent}{0pt}
\begin{document}
\setlength{\test}{0pt}
Length comparisons:\
- \ifdimcomp{\test}{=}{0.0pt}{Equal}{Not equal}\
- \ifdimcomp{\test}{=}{0pt}{Equal}{Not equal}
\bigskip
String comparisons (\verb|\the\test| expands to \the\test):\
3. \ifstrequal{\the\test}{0.0pt}{Equal}{Not equal}\
4. \expandafter\ifstrequal\expandafter{\the\test}{0.0pt}{Equal}{Not equal}
\bigskip
\setlength{\test}{0.1pt}
Length then string comparison with \verb|0.1pt|:\
5. \ifdimcomp{\test}{=}{0.0pt}{Equal}{Not equal}\
6. \expandafter\ifstrequal\expandafter{\the\test}{0.0pt}{Equal}{Not equal}
\end{document}

And finally, the promised examples with the ifthen package:
\documentclass{article}
\usepackage{ifthen}
\newlength{\test}
\setlength{\parindent}{0pt}
\begin{document}
\setlength{\test}{0pt}
Length comparisons:\
- \ifthenelse{\lengthtest{\test=0.0pt}}{Equal}{Not equal}\
- \ifthenelse{\lengthtest{\test=0pt}}{Equal}{Not equal}
\bigskip
String comparisons (\verb|\the\test| expands to \the\test):\
3. \ifthenelse{\equal{\the\test}{0.0pt}}{Equal}{Not equal}\
4. \ifthenelse{\equal{\the\test}{\detokenize{0.0pt}}}{Equal}{Not equal}\
5. \ifthenelse{\equal{\the\test}{\detokenize{0pt}}}{Equal}{Not equal}
\bigskip
\setlength{\test}{0.1pt}
Length then string comparison with \verb|0.1pt|:\
6. \ifthenelse{\lengthtest{\test=0.0pt}}{Equal}{Not equal}\
7. \ifthenelse{\equal{\the\test}{0.0pt}}{Equal}{Not equal}
\end{document}

Footnote
You can obtain space tokens from expanding \the\test after doing for instance:
\newlength{\test}%
\setlength{\test}{0.1pt plus 3pt minus 1pt}
After executing this, using expl3's \tl_analysis_show:n function to analyse each token in the expansion of \the\test:
```latex
\documentclass{article}
\usepackage{expl3}
\newlength{\test}
\setlength{\test}{0.1pt plus 3pt minus 1pt}
\ExplSyntaxOn
\cs_generate_variant:Nn \tl_analysis_show:n { o }
% One expansion step on \the\test, result passed to \tl_analysis_show:n
\tl_analysis_show:o { \the\test }
\ExplSyntaxOff
\begin{document}
\end{document}
</code></pre>
<p>produces the following output on the terminal:</p>
<pre><code>```none
> 0 (the character 0)
> . (the character .)
> 1 (the character 1)
> p (the character p)
> t (the character t)
> (blank space )
> p (the character p)
> l (the character l)
> u (the character u)
> s (the character s)
> (blank space )
> 3 (the character 3)
> . (the character .)
> 0 (the character 0)
> p (the character p)
> t (the character t)
> (blank space )
> m (the character m)
> i (the character i)
> n (the character n)
> u (the character u)
> s (the character s)
> (blank space )
> 1 (the character 1)
> . (the character .)
> 0 (the character 0)
> p (the character p)
> t (the character t).
0with.as these are the next tokens. Beside this: \if and \ifdim are not latex but tex primitives. If you want to use latex commands check the etoolbox package or expl3. – Ulrike Fischer Jan 27 '20 at 12:00etoolboxpackage and the comparisons you find there – daleif Jan 27 '20 at 12:00TeXorLaTeXper se... I just want to be able to compare two strings and do a thing when I've done so! I've played around withetoolboxbut also getting the hang of the various commands it exposes. Is\ifdefstrequalthe one I'd use if one piece of text were in a macro and another were constant? – tobriand Jan 27 '20 at 12:19