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 5 package internal 6 7 import ( 8 "strings" 9 ) 10 11 func parseFullAppID(appid string) (partition, domain, displayID string) { 12 if i := strings.Index(appid, "~"); i != -1 { 13 partition, appid = appid[:i], appid[i+1:] 14 } 15 if i := strings.Index(appid, ":"); i != -1 { 16 domain, appid = appid[:i], appid[i+1:] 17 } 18 return partition, domain, appid 19 } 20 21 // appID returns "appid" or "domain.com:appid". 22 func appID(fullAppID string) string { 23 _, dom, dis := parseFullAppID(fullAppID) 24 if dom != "" { 25 return dom + ":" + dis 26 } 27 return dis 28 } 29