First of all I hope that you can read all the comments.
As previously, I didn’t check the algorithm, but I try here below to explain what is the rationale behind.
Since your concern is about the positions of spaces, within the name, and the length of the RSSI, my hypotesis is, according to @davidefa statement, that the RSSI (whatever its length is) is the last part of the string containing the BLE data.
By reversing that string, the RSSI becomes the fist data. The algorithm then searches for the first blank in the reversed string. When it finds the first blank, the characters before that blank are the (reversed) RSSI, so by reversing that portion you’ll have the RSSI (streight).
At that point the pointer of the reversed string is pointing to the first non blank character in the rest of the original, but reversed, string containing MAC+Name+RSSI. The algorithm then, starting from the pointer, creates a temporary variable, called Mac_and_Name, which contains only the MAC and the Name, and reverses it (to have it streight). Now, supposing that the MAC doesn’t contain any blank (space), by searching in the temporary variable the first blank, you can discard the first part which is the MAC and retain only the second that should be the name. I filled the blocks with comments hoping that they can help you in understanding the algorithm.
Surely not the most elegant algorithm, but (probably) it works….
Je peux l’écrire en Français, si tu prefère, mais il va couter quelque temps, car mon Français est un peu (beaucoup) ruillé 
Bonne chance.