how to find the first character of a particular line.

I am trying to remove the section of line till the cursor but I can’t get the first char so that I will just replaceRange with null

state.doc.lineAt(cursorPos).from