UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

SOLVED: printing a year

Forums > SwiftUI

I've got a JSON file I am decoding. One of the fields contains a year, which in my model I have said its an int.

When I display it, the value shows but has a comma, eg 2,020

I do not want to display the comma.

How best should I change the code?

3      

hi,

it may depend only on how you display it.

  • Text(String(year)) should give you 2020
  • Text("\(year)") should give you 2,020

it seems that Text wants to do its own sort of localization with string interpolation (or, more precisely i think, Int does its own thing with string interpolation).

hope that helps

DMG

8      

thanks. i knew it should be something very simple

3      

Hit the same thing, and this was precisely the answer, so seconding MrG's thanks!

4      

My 8x10 photo printer setup is similar to yours. A LAN and an IoT VLAN are both available.

IoT can't communicate with LAN unless the LAN initiates the conversation, which appears to be the situation in your case (your PC on your LAN tries to talk with your printer on your IoT.)

You'll require something similar to this:

Allow Established / Related IoT to LAN

(In this case, the source is my IoT network, the destination is my LAN network, and “match state established” and “match state related” are both enabled under advanced.)

VLAN for IoT to any > Get rid of everything (Here the source is my IoT network, dest is any)

3      

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.