The complete code is somewhat more difficult to post.
It is a logging postprocessor for unity.
I run it by piping the result of a unity command line build to a command line tool.
The plain text output from the buidl is similar to, ( this could be simulated by using ls | mycommandlinetool)
512.2 kb 1.3% Built-in Texture2D: SpriteAtlasTexture-OUTFIT_DOCTOR-1024x1024-fmt33
512.2 kb 1.3% Assets/AssetBundleContent/Egg/DressDragon/Garments/MagicianOutfit/magician_longsleevedshirt_texture.png
512.2 kb 1.3% Assets/AssetBundleContent/Egg/DressDragon/Garments/SantaOutfit/santa_shirt_texture_asset.png
512.2 kb 1.3% Assets/AssetBundleContent/Egg/DressDragon/Garments/SantaOutfit/santa_pants_texture_asset.png
512.2 kb 1.3% Assets/AssetBundleContent/Egg/DressDragon/Garments/LuciaOutfit/lucia_skirt_texture_asset.png
I use
while let line = readLine() {
// Line is one row and I split it on space
var paramArr = line.split(separator: " ")
// Key is last parameter of the split
let key = (paramArr[paramArr.count - 1])
//Change it to a lowercased string
let keyStr:String = key.lowercased()
//Print it out to be certain no trailing characers exist
print("->" + keyStr + "<-")
//Print out the test
print(keyStr.hasSuffix(".png"))
}
Output result is
->assets/assetbundlecontent/egg/mailbox/packages/snowplow/snowplow.png<-
false
->assets/assetbundlecontent/egg/mailbox/packages/frog/mailbox_item_frog_croak.wav<-
false
->assets/assetbundlecontent/egg/gardendecorations/snowcannon/sprites/snow_cannon_tip_asset.png<-
false