Help to make some code improvements

Have removed the VBA support needs from a project, and would like to improve a couple of small code blocks though. Have included the LO BASIC code blocks for anyone who is willing to help with improvements.

‘’
’ Block 1
’ Get number of ‘x’ or ‘X’ flags in array.
‘’

Flags_Count = 0
For i=0 to UBound(Flags_Array())
    If Flags_Array(i) = "x" OR Flags_Array(i) = "X" Then
        Flags_Count = Flags_Count + 1
    End If
Next

‘’
’ Block 2
’ If the last character is a line feed, Chr(10), then remove it to prevent an
’ empty record row.
‘’

For i=1 To Len(strCSV)
	If ( InStr(Len(strCSV), strCSV, Chr(10)) ) Then
		strCSV = Left(strCSV, Len(strCSV)-1)
		i = i + 1
	Else Exit For
	End If
Next

Dim Rows() As String
Rows = Split(strCSV, Chr(10))

Hallo
(of course python!)
Block1:


flags_count = sum( char.lower() == "x" for char in iterable )

Block2:

rows = strcsv.strip().split("\n")