Obviously you will need to know the type of confidence interval you are dealing with, but let's suppose that this is a standard one-sample confidence interval for the mean, using the standard T-statistic as the pivotal quantity. In that case, the formula for the interval is:
$$\text{CI}(1-\alpha) = \Bigg[ \bar{x} \pm \frac{t_{n-1, \alpha/2}}{\sqrt{n}} \cdot s \Bigg].$$
Thus, if we denote the known lower and upper bounds of the interval as $l$ and $u$ respectively, then you can algebraically reverse-engineer the sample mean and sample standard deviation as:
$$\bar{x} = \frac{l+u}{2}
\quad \quad \quad \quad \quad
s = \frac{u-l}{2} \cdot \frac{\sqrt{n}}{t_{n-1, \alpha/2}}.$$
With the values specified in your example, you get:
#Set preliminary values
l <- 5.18;
u <- 5.38;
n <- 300;
alpha <- 0.05;
#Compute sample mean and SD
crit <- qt(alpha/2, df = n-1, lower.tail = FALSE);
MEAN <- (l+u)/2;
SD <- (u-l)*sqrt(n)/(2*crit);
#Print the values
MEAN;
[1] 5.28
SD;
[1] 0.8801386
Thus, assuming that your interval was a standard one-sample confidence interval, you must have had a sample mean $\bar{x} = 5.28$ and sample standard deviation $s = 0.88$.
Best Answer
The sample standard deviation is given by
$$\begin{align*} s &=\sqrt{\frac{\sum\left(x_i-\bar{x}\right)^2}{n-1}}\\\\ &=\sqrt{\frac{\sum\left(x_i^2-2x_i\bar{x}+\bar{x}^2\right)}{n-1}}\\\\ &=\sqrt{\frac{n\bar{x}^2+\sum x_i^2-2\bar{x}\sum x_i}{n-1}}\\\\ &=\sqrt{\frac{n\bar{x}^2+\sum x_i^2-2n\bar{x}^2}{n-1}}\\\\ &=\sqrt{\frac{\sum x_i^2-n\bar{x}^2}{n-1}}\\\\ \end{align*}$$
so having $\bar{x}, n,\text{ and}\sum x_i^2$ suffices for calculating the sample standard deviation.