mirror of
https://github.com/thegeeklab/wp-matrix.git
synced 2024-11-14 10:00:39 +00:00
28 lines
535 B
Go
28 lines
535 B
Go
|
package gomatrix
|
||
|
|
||
|
import "fmt"
|
||
|
|
||
|
func ExampleEncodeUserLocalpart() {
|
||
|
localpart := EncodeUserLocalpart("Alph@Bet_50up")
|
||
|
fmt.Println(localpart)
|
||
|
// Output: _alph=40_bet__50up
|
||
|
}
|
||
|
|
||
|
func ExampleDecodeUserLocalpart() {
|
||
|
localpart, err := DecodeUserLocalpart("_alph=40_bet__50up")
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
fmt.Println(localpart)
|
||
|
// Output: Alph@Bet_50up
|
||
|
}
|
||
|
|
||
|
func ExampleExtractUserLocalpart() {
|
||
|
localpart, err := ExtractUserLocalpart("@alice:matrix.org")
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
fmt.Println(localpart)
|
||
|
// Output: alice
|
||
|
}
|