We have measured polarized x-ray-absorption near-edge structure and extended x-ray-absorption fine structure spectra at the Mn K edge on La1-xSr1+xMnO4 samples with x=0, 0.3, and 0.5 at different temperatures from 50 K up to 300 K. Both fluorescence and total electron yield modes were used for polarized measurements, whereas nonpolarized absorption spectra have also been recorded in transmission mode on powder samples for x=0, 0.3, 0.45, 0.5, and 0.55. The experiment discards the presence of distinct Mn3+/Mn4+ integer valence states for any of the mixed-valence samples (x=0.3,0.5) in the whole temperature range. The local structure (geometrical and electronic) around the Mn atom is anisotropic in all samples. Moreover, there is no significant change in the Mn local geometric and electronic structure of compounds with 0.45 <= x <= 0.55 crossing the charge-ordering transition (T-CO=230 K). The anisotropy in the absorption spectra is then explained in terms of the tetragonal distortion of the MnO6 octahedron. It decreases as x increases, the oxygen environment being nearly isotropic for La0.5Sr1.5MnO4. Anisotropy is also observed at the prepeaks. The intensity of the in-plane structures strongly increases with the Sr content, indicating that the doped holes mainly go into the ab plane. We conclude that the electronic state of Mn atoms can be only described in terms of an intermediate valence, even for anisotropic samples such as two-dimensional La-Sr manganites.