本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
679B

  1. // Copyright 2011 Google Inc. All rights reserved.
  2. // Use of this source code is governed by the Apache 2.0
  3. // license that can be found in the LICENSE file.
  4. package internal
  5. import (
  6. "strings"
  7. )
  8. func parseFullAppID(appid string) (partition, domain, displayID string) {
  9. if i := strings.Index(appid, "~"); i != -1 {
  10. partition, appid = appid[:i], appid[i+1:]
  11. }
  12. if i := strings.Index(appid, ":"); i != -1 {
  13. domain, appid = appid[:i], appid[i+1:]
  14. }
  15. return partition, domain, appid
  16. }
  17. // appID returns "appid" or "domain.com:appid".
  18. func appID(fullAppID string) string {
  19. _, dom, dis := parseFullAppID(fullAppID)
  20. if dom != "" {
  21. return dom + ":" + dis
  22. }
  23. return dis
  24. }
上海开阖软件有限公司 沪ICP备12045867号-1