parse Address
Parses and validates a Stellar address into username and domain components.
A valid Stellar address must follow the format username*domain where:
Username is the identifier portion (before the
*)Domain is the federation server's domain (after the
*)Neither component can be empty
Only one
*separator is allowed
Return
Pair of (username, domain)
Parameters
address
The Stellar address to parse (e.g., "bob*stellar.org")
Throws
If the address format is invalid
Example:
val (username, domain) = FederationService.parseAddress("bob*stellar.org")
println("Username: $username") // "bob"
println("Domain: $domain") // "stellar.org"
// Validation errors
FederationService.parseAddress("invalid") // No * separator
FederationService.parseAddress("*stellar.org") // Empty username
FederationService.parseAddress("bob*") // Empty domain
FederationService.parseAddress("bob*multi*sep") // Multiple separatorsContent copied to clipboard