# Finding the length of arbitrary ASCII character strings

I have implemented this MIPS code to determine the length of given ASCII character strings. Is there a simpler way to implement this code? Is there is a built-in function in MIPS?

Given String:

"Hello\n"

Output:

6

.data
message: .asciiz "Hello\n"
.text

main:
li $t1,0 la$t0,message

loop:
lb   $a0,0($t0)
beqz $a0,done addi$t0,$t0,1 addi$t1,$t1,1 j loop done: li$v0,1
add  $a0,$0,$t1 syscall li$v0,10
syscall